summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 15:48:47 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 15:48:47 +0200
commitc7f322c91faf97a9f758c288b38e1385fd89b32d (patch)
treecf2a4cf562acffdf5b4b96d84e34f29c7f428458 /sql/sql_class.cc
parentd5ce7824444b7491f420061076ae5087d4829428 (diff)
parent8036d0a3590dddf4d51ba02bc74ba3a5a96674f7 (diff)
downloadmariadb-git-c7f322c91faf97a9f758c288b38e1385fd89b32d.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 0c0a1ec98ae..869ce72f861 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -4802,7 +4802,8 @@ extern "C" size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen)
if (!mysql_mutex_trylock(&thd->LOCK_thd_data))
{
len= MY_MIN(buflen - 1, thd->query_length());
- memcpy(buf, thd->query(), len);
+ if (len)
+ memcpy(buf, thd->query(), len);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
buf[len]= '\0';