Commit a90066b1 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-11641 innobase_get_stmt_safe() does not copy the last byte of thd->query_string

innobase_get_stmt_safe(): Copy also the last byte.
parent 703d0985
......@@ -2465,8 +2465,8 @@ innobase_get_stmt_safe(
stmt = thd ? thd_query_string(thd) : NULL;
if (stmt && stmt->str) {
length = stmt->length > buflen ? buflen : stmt->length;
memcpy(buf, stmt->str, length-1);
length = stmt->length >= buflen ? buflen - 1 : stmt->length;
memcpy(buf, stmt->str, length);
buf[length]='\0';
} else {
buf[0]='\0';
......
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