From 4bb81eefbd2a0093d0d3c1b9f4aa1de027512834 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 11 May 2017 17:33:30 +0100 Subject: 41096: Don't assume null termination copying string. At this point the string may contain embedded nulls or not have a null termination at all. Also, as we always have the length memcpy() is more efficient. --- Src/string.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Src/string.c') diff --git a/Src/string.c b/Src/string.c index a8da14fe0..9e14ef949 100644 --- a/Src/string.c +++ b/Src/string.c @@ -52,7 +52,8 @@ dupstring_wlen(const char *s, unsigned len) if (!s) return NULL; t = (char *) zhalloc(len + 1); - strcpy(t, s); + memcpy(t, s, len); + t[len] = '\0'; return t; } -- cgit 1.4.1