summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/sql_audit.h2
-rw-r--r--sql/sql_prepare.cc5
-rw-r--r--tests/mysql_client_test.c6
3 files changed, 9 insertions, 4 deletions
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index 97317203e34..d76750e9b2a 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -155,7 +155,7 @@ void mysql_audit_general(THD *thd, uint event_subtype,
DBUG_ENTER("mysql_audit_general");
if (mysql_audit_general_enabled())
{
- char user_buff[MAX_USER_HOST_SIZE];
+ char user_buff[MAX_USER_HOST_SIZE+1];
mysql_event_general event;
event.event_subclass= event_subtype;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index a3027ea52fd..06e7921c90d 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3442,6 +3442,11 @@ static void mysql_stmt_execute_common(THD *thd,
stmt_id == LAST_STMT_ID, read_types))
{
my_error(ER_MALFORMED_PACKET, MYF(0));
+ /*
+ Let's set the thd->query_string so the audit plugin
+ can report the executed query that failed.
+ */
+ thd->set_query_inner(stmt->query_string);
DBUG_VOID_RETURN;
}
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 32681ac20a1..78656850e48 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -5256,10 +5256,10 @@ static void test_manual_sample()
{
unsigned int param_count;
MYSQL_STMT *stmt;
- short small_data;
- int int_data;
+ short small_data= 1;
+ int int_data= 2;
int rc;
- char str_data[50];
+ char str_data[50]= "std_data";
ulonglong affected_rows;
MYSQL_BIND my_bind[3];
my_bool is_null;