diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-09-03 09:26:54 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-09-03 09:26:54 +0300 |
commit | c3752cef3c34589ea95a7ab66cff3dd5b11290d5 (patch) | |
tree | c7b8eb21dedd3139dacf2c0a12bed6e362afa1d9 /mysys | |
parent | 56ae0adee35c1bc053711a8579857e6b0301eb80 (diff) | |
parent | 2a93e632b1676b6df3dde150888d6428a57f8399 (diff) | |
download | mariadb-git-c3752cef3c34589ea95a7ab66cff3dd5b11290d5.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/mf_iocache.c | 8 | ||||
-rw-r--r-- | mysys/my_alloc.c | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 2f3658e6f1b..9b3fd6a97b8 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates - Copyright (c) 2010, 2015, MariaDB + Copyright (c) 2010, 2020, MariaDB 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 @@ -804,7 +804,8 @@ int _my_b_cache_read(IO_CACHE *info, uchar *Buffer, size_t Count) info->read_pos=info->buffer+Count; info->read_end=info->buffer+length; info->pos_in_file=pos_in_file; - memcpy(Buffer, info->buffer, Count); + if (Count) + memcpy(Buffer, info->buffer, Count); DBUG_RETURN(0); } @@ -1305,7 +1306,8 @@ static int _my_b_cache_read_r(IO_CACHE *cache, uchar *Buffer, size_t Count) DBUG_RETURN(1); } cnt= (len > Count) ? Count : len; - memcpy(Buffer, cache->read_pos, cnt); + if (cnt) + memcpy(Buffer, cache->read_pos, cnt); Count -= cnt; Buffer+= cnt; left_length+= cnt; diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index c5fe75c1410..0263283221b 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -1,5 +1,6 @@ /* Copyright (c) 2000, 2010, Oracle and/or its affiliates + Copyright (c) 2010, 2020, MariaDB 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 @@ -479,7 +480,8 @@ char *strmake_root(MEM_ROOT *root, const char *str, size_t len) char *pos; if ((pos=alloc_root(root,len+1))) { - memcpy(pos,str,len); + if (len) + memcpy(pos,str,len); pos[len]=0; } return pos; |