summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 14:19:21 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-02 14:19:21 +0200
commit8036d0a3590dddf4d51ba02bc74ba3a5a96674f7 (patch)
tree13fc7d26725fc5fd58a058b5d8563afef0835ae3 /include
parentd2fab686670fcc6d23930298e4256734dfdbc413 (diff)
downloadmariadb-git-8036d0a3590dddf4d51ba02bc74ba3a5a96674f7.tar.gz
MDEV-22387: Do not violate __attribute__((nonnull))
This follows up commit commit 94a520ddbe39ae97de1135d98699cf2674e6b77e and commit 7c5519c12d46ead947d341cbdcbb6fbbe4d4fe1b. After these changes, the default test suites on a cmake -DWITH_UBSAN=ON build no longer fail due to passing null pointers as parameters that are declared to never be null, but plenty of other runtime errors remain.
Diffstat (limited to 'include')
-rw-r--r--include/my_sys.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 08b06951d0d..ac1730eeaff 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -534,8 +534,11 @@ static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
if (info->write_pos + Count <= info->write_end)
{
- memcpy(info->write_pos, Buffer, Count);
- info->write_pos+= Count;
+ if (Count)
+ {
+ memcpy(info->write_pos, Buffer, Count);
+ info->write_pos+= Count;
+ }
return 0;
}
return _my_b_write(info, Buffer, Count);