[Groonga-mysql-commit] mroonga/mroonga at 4a3a874 [master] mysql57: follow THD::db type change

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Mar 14 23:43:14 JST 2015


Kouhei Sutou	2015-03-14 23:43:14 +0900 (Sat, 14 Mar 2015)

  New Revision: 4a3a874e2074eedb051d803aad20c5a3e9e72033
  https://github.com/mroonga/mroonga/commit/4a3a874e2074eedb051d803aad20c5a3e9e72033

  Message:
    mysql57: follow THD::db type change
    
    I don't know whether THD::db() (LEX_CSTRING) is NULL
    terminated. Generally, LEX_CSTRING isn't NULL terminated.
    
    If THD::db() isn't NULL terminated, Mroonga may crash.

  Modified files:
    mrn_mysql_compat.h
    udf/mrn_udf_command.cpp

  Modified: mrn_mysql_compat.h (+7 -1)
===================================================================
--- mrn_mysql_compat.h    2015-03-14 23:42:42 +0900 (6d4bb54)
+++ mrn_mysql_compat.h    2015-03-14 23:43:14 +0900 (5d449f5)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2011-2014 Kouhei Sutou <kou �� clear-code.com>
+  Copyright(C) 2011-2015 Kouhei Sutou <kou �� clear-code.com>
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -158,4 +158,10 @@
 #  define MRN_STRING_FREE(string) string.free();
 #endif
 
+#if MYSQL_VERSION_ID >= 50706 && !defined(MRN_MARIADB_P)
+#  define MRN_THD_DB_PATH(thd) ((thd)->db().str)
+#else
+#  define MRN_THD_DB_PATH(thd) ((thd)->db)
+#endif
+
 #endif /* MRN_MYSQL_COMPAT_H_ */

  Modified: udf/mrn_udf_command.cpp (+1 -1)
===================================================================
--- udf/mrn_udf_command.cpp    2015-03-14 23:42:42 +0900 (ddf3e4e)
+++ udf/mrn_udf_command.cpp    2015-03-14 23:43:14 +0900 (d14f3ff)
@@ -68,7 +68,7 @@ MRN_API my_bool mroonga_command_init(UDF_INIT *initid, UDF_ARGS *args,
 
   grn_ctx_init(&(info->ctx), 0);
   {
-    const char *current_db_path = current_thd->db;
+    const char *current_db_path = MRN_THD_DB_PATH(current_thd);
     const char *action;
     if (current_db_path) {
       action = "open database";
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-mysql-commit mailing list
Back to archive index