MDEV-21341: Fix UBSAN failures, part #3

One may not call memcpy(dst, src=NULL, size), even if size==0.
This commit is contained in:
Sergei Petrunia 2019-12-18 13:11:07 +03:00
parent 8b9db11718
commit 984b3c1544

View file

@ -297,7 +297,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
pos+= reclength;
int2store(pos, create_info->connect_string.length);
pos+= 2;
memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
if (create_info->connect_string.length)
memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
pos+= create_info->connect_string.length;
int2store(pos, str_db_type.length);
pos+= 2;