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.
This commit is contained in:
Marko Mäkelä 2017-02-15 13:45:14 +02:00
parent 703d0985ee
commit a90066b1c7

View file

@ -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';