Skip to content

Commit 38b79d7

Browse files
author
Alexey Botchkov
committed
MENT-1019.
Audit-plugin related fixes.
1 parent 582cf12 commit 38b79d7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

sql/sql_audit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void mysql_audit_general(THD *thd, uint event_subtype,
155155
DBUG_ENTER("mysql_audit_general");
156156
if (mysql_audit_general_enabled())
157157
{
158-
char user_buff[MAX_USER_HOST_SIZE];
158+
char user_buff[MAX_USER_HOST_SIZE+1];
159159
mysql_event_general event;
160160

161161
event.event_subclass= event_subtype;

sql/sql_prepare.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,6 +3442,11 @@ static void mysql_stmt_execute_common(THD *thd,
34423442
stmt_id == LAST_STMT_ID, read_types))
34433443
{
34443444
my_error(ER_MALFORMED_PACKET, MYF(0));
3445+
/*
3446+
Let's set the thd->query_string so the audit plugin
3447+
can report the executed query that failed.
3448+
*/
3449+
thd->set_query_inner(stmt->query_string);
34453450
DBUG_VOID_RETURN;
34463451
}
34473452

tests/mysql_client_test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5256,10 +5256,10 @@ static void test_manual_sample()
52565256
{
52575257
unsigned int param_count;
52585258
MYSQL_STMT *stmt;
5259-
short small_data;
5260-
int int_data;
5259+
short small_data= 1;
5260+
int int_data= 2;
52615261
int rc;
5262-
char str_data[50];
5262+
char str_data[50]= "std_data";
52635263
ulonglong affected_rows;
52645264
MYSQL_BIND my_bind[3];
52655265
my_bool is_null;

0 commit comments

Comments
 (0)