changeset 2119:3b26f3a58cb9

Fix command line issue reported by Minos Fix small memory corruption in strip_arg_special_chars(). strcpy() cannot be used there because the areas overlap.
author Mikael Berthe <mikael@lilotux.net>
date Tue, 24 Jun 2014 18:56:24 +0200
parents 51fde9c25401
children adcff2d51ecb
files mcabber/mcabber/utils.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/utils.c	Mon Jun 09 10:01:48 2014 +0200
+++ b/mcabber/mcabber/utils.c	Tue Jun 24 18:56:24 2014 +0200
@@ -589,13 +589,17 @@
     if (*p == '"') {
       if (!escape) {
         instring = !instring;
-        strcpy(p, p+1);
+        //memmove(p, p+1, strlen(p));
+        for (char *t=p; *t; t++)
+          *t = *(t+1);
         p--;
       } else
         escape = FALSE;
     } else if (*p == '\\') {
       if (!escape) {
-        strcpy(p, p+1);
+        //memmove(p, p+1, strlen(p));
+        for (char *t=p; *t; t++)
+          *t = *(t+1);
         p--;
       }
       escape = !escape;