summaryrefslogtreecommitdiff
path: root/strings/strmake.c
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-07-16 16:13:26 +0300
committerGeorgi Kodinov <joro@sun.com>2009-07-16 16:13:26 +0300
commit1a4bc9a1e429697f86f63f2599e49a4f2d29cd32 (patch)
tree8613fbaf4b7efe3fbb7d6591b81037c11ba7cfad /strings/strmake.c
parent7a91bf8c9131e3622684684b6e45c0282c4701e3 (diff)
downloadmariadb-git-1a4bc9a1e429697f86f63f2599e49a4f2d29cd32.tar.gz
Bug #46042: backported the fix for the valgrind warning from 5.1
Diffstat (limited to 'strings/strmake.c')
-rw-r--r--strings/strmake.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/strings/strmake.c b/strings/strmake.c
index 05b5878d99c..acc220bbf1c 100644
--- a/strings/strmake.c
+++ b/strings/strmake.c
@@ -41,9 +41,9 @@ char *strmake(register char *dst, register const char *src, uint length)
write a character rather than '\0' as this makes spotting these
problems in the results easier.
*/
- uint n= strlen(src) + 1;
- if (n <= length)
- memset(dst + n, (int) 'Z', length - n + 1);
+ uint n= 0;
+ while (n < length && src[n++]);
+ memset(dst + n, (int) 'Z', length - n + 1);
#endif
while (length--)