summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-10-30 16:48:37 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-10-30 16:48:37 +0200
commit9e840d6898fb3739b441597b9da52c6eba8fe323 (patch)
tree73882a74ff5dc6ff56465d7d438479f10939bb4b /sql/sql_class.cc
parent03357ded174c13d941abc37e8c12506d75aaa52d (diff)
downloadmariadb-git-bb-10.5-MDEV-22387.tar.gz
WIP MDEV-22387bb-10.5-MDEV-22387
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 6011dbbc6dd..a4fd26cf7d8 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -4982,7 +4982,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';