diff options
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-bin.c | 4 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index e4bd6d2b5c2..c052e427322 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -1,6 +1,6 @@ /* Copyright (c) 2002-2007 MySQL AB & tommy@valley.ne.jp Copyright (c) 2002, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, SkySQL Ab. + Copyright (c) 2009, 2020, MariaDB Corporation. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -399,7 +399,7 @@ my_strnxfrm_8bit_bin(CHARSET_INFO *cs, { set_if_smaller(srclen, dstlen); set_if_smaller(srclen, nweights); - if (dst != src) + if (srclen && dst != src) memcpy(dst, src, srclen); return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen, (uint)(nweights - srclen), flags, 0); diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index cbf50c638fd..afc5771d6c5 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -553,9 +553,11 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), alloced= a= (uchar*) my_malloc(a_length+b_length+2, MYF(MY_FAE)); b= a + a_length+1; - memcpy((char*) a, (char*) a0, a_length); + if (a_length) + memcpy((char*) a, (char*) a0, a_length); a[a_length]= 0; /* if length(a0)> len1, need to put 'end of string' */ - memcpy((char *)b, (char *)b0, b_length); + if (b_length) + memcpy((char *)b, (char *)b0, b_length); b[b_length]= 0; /* put end of string */ a_length= thai2sortable(a, a_length); b_length= thai2sortable(b, b_length); |