about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/Zle/computil.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 97751c16e..ed44bcf26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-11-09  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 43793: Kamil: Src/Zle/computil.c: could overrun buffer by 1 byte.
+
 	* 43791: Kamil: Src/Modules/clone.c: file descriptor was closed twice.
 
 2018-11-08  Oliver Kiddle  <okiddle@yahoo.co.uk>
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 5526e0ad0..cb1c01042 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -561,9 +561,9 @@ cd_init(char *nam, char *hide, char *mlen, char *sep,
                 if (str->str == str->match)
                     str->str = ztrdup(str->str);
                 if (hide[1] && str->str[0] == '-' && str->str[1] == '-')
-                    strcpy(str->str, str->str + 2);
+                    memmove(str->str, str->str + 2, strlen(str->str) - 1);
                 else if (str->str[0] == '-' || str->str[0] == '+')
-                    strcpy(str->str, str->str + 1);
+                    memmove(str->str, str->str + 1, strlen(str->str));
             }
         }
 	for (ap = args; *args &&