about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/string.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ed4b9972d..670fc9d89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-11  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 41096: Src/string.c: Fix dupstring_wlen() for unmetafied
+	string.  It's not safe to assume null termination.
+
 2017-05-09  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* unposted: Test/D02glob.ztst: Adding comment to test changed
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;
 }