Commit 51d58f56 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-18350 Using audit plugin with MySQL, mysqld crashes when running...

MDEV-18350 Using audit plugin with MySQL, mysqld crashes when running COM_INIT_DB against invalid database.

mysql_event_general structure changed in 10.3.
the database_length should be size_t now instead of the int.
parent f6d0d309
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104 #define PLUGIN_VERSION 0x104
#define PLUGIN_STR_VERSION "1.4.7" #define PLUGIN_STR_VERSION "1.4.8"
#define _my_thread_var loc_thread_var #define _my_thread_var loc_thread_var
...@@ -2260,7 +2260,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0) ...@@ -2260,7 +2260,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
} }
int get_db_mysql57(MYSQL_THD thd, char **name, int *len) int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len)
{ {
int db_off; int db_off;
int db_len_off; int db_len_off;
...@@ -2287,7 +2287,7 @@ int get_db_mysql57(MYSQL_THD thd, char **name, int *len) ...@@ -2287,7 +2287,7 @@ int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
#ifdef __linux__ #ifdef __linux__
*name= *(char **) (((char *) thd) + db_off); *name= *(char **) (((char *) thd) + db_off);
*len= *((int *) (((char*) thd) + db_len_off)); *len= *((size_t *) (((char*) thd) + db_len_off));
if (*name && (*name)[*len] != 0) if (*name && (*name)[*len] != 0)
return 1; return 1;
return 0; return 0;
......
...@@ -16,7 +16,7 @@ enum enum_server_command{ SERVCOM_A, SERVCOM_B }; ...@@ -16,7 +16,7 @@ enum enum_server_command{ SERVCOM_A, SERVCOM_B };
#include "plugin_audit_v4.h" #include "plugin_audit_v4.h"
extern void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev); extern void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev);
extern int get_db_mysql57(MYSQL_THD thd, char **name, int *len); extern int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len);
struct mysql_event_general_302 struct mysql_event_general_302
...@@ -35,7 +35,7 @@ struct mysql_event_general_302 ...@@ -35,7 +35,7 @@ struct mysql_event_general_302
unsigned long long general_rows; unsigned long long general_rows;
unsigned long long query_id; unsigned long long query_id;
char *database; char *database;
int database_length; size_t database_length;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment