diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-02-15 13:45:14 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-02-15 13:45:14 +0200 |
commit | a90066b1c7618f6d121eb7079c2939f21c6ad863 (patch) | |
tree | 3ce3d0e10cf97ccb896321c2f87c2579515e3a9c | |
parent | 703d0985ee761a81af5d9b8d4374d847dba7cd76 (diff) | |
download | mariadb-git-a90066b1c7618f6d121eb7079c2939f21c6ad863.tar.gz |
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.
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e53253db19c..ef599bc5d04 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -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'; |