diff --git a/lib/Query_Processor.cpp b/lib/Query_Processor.cpp index 02d939d4e..b14bfa2ac 100644 --- a/lib/Query_Processor.cpp +++ b/lib/Query_Processor.cpp @@ -1024,7 +1024,11 @@ void Query_Processor::query_parser_init(SQP_par_t *qp, char *query, int query_le #endif /* DEBUG */ } else { if (mysql_thread___commands_stats) { - qp->query_prefix=strndup(query,32); + size_t sl=32; + if ((unsigned int)query_length < sl) { + sl=query_length; + } + qp->query_prefix=strndup(query,sl); } } };