summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 12:49:19 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 12:49:19 +0200
commit09a1f0075a8d5752dd7b2940a20d86a040af1741 (patch)
tree42c96cf95d5df2950b77329c76c0024f33088aff /sql/protocol.cc
parente6f95b23f425001a14a528256354e0faf4e272f6 (diff)
parent440d4b282dd4992d64abdd6289859598db7e5f75 (diff)
downloadmariadb-git-09a1f0075a8d5752dd7b2940a20d86a040af1741.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index d5e6a7b92bf..65443cafa65 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -57,7 +57,8 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length)
packet->realloc(packet_length+9+length))
return 1;
uchar *to= net_store_length((uchar*) packet->ptr()+packet_length, length);
- memcpy(to,from,length);
+ if (length)
+ memcpy(to,from,length);
packet->length((uint) (to+length-(uchar*) packet->ptr()));
return 0;
}
@@ -730,7 +731,8 @@ void net_send_progress_packet(THD *thd)
uchar *net_store_data(uchar *to, const uchar *from, size_t length)
{
to=net_store_length_fast(to,length);
- memcpy(to,from,length);
+ if (length)
+ memcpy(to,from,length);
return to+length;
}