2012-03-16 Chris January <chris.january@allinea.com>
authorTom Tromey <tromey@redhat.com>
Fri, 16 Mar 2012 18:20:34 +0000 (18:20 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 16 Mar 2012 18:20:34 +0000 (18:20 +0000)
* source.c (add_path): Use memmove instead of strcpy because the
strings overlap.

gdb/ChangeLog
gdb/source.c

index 706788cf63350fb29d7ce710c9cc7f02c8ecdbab..473c0fdbc249aa2185bc6aaa984e6bcdf253b3cd 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-16  Chris January  <chris.january@allinea.com>
+
+       * source.c (add_path): Use memmove instead of strcpy because the
+       strings overlap.
+
 2012-03-16  Joel Brobecker  <brobecker@adacore.com>
 
        * value.h (set_value_parent): Add declaration.
index cfdf81b2a0092b5cd7fdfa103a97d7490bd3b70e..97f5d46d21935bf0e4d71452def57f0f4969326c 100644 (file)
@@ -588,7 +588,7 @@ add_path (char *dirname, char **which_path, int parse_separators)
                  p--;          /* Back over leading separator.  */
                if (prefix > p - *which_path)
                  goto skip_dup;        /* Same dir twice in one cmd.  */
-               strcpy (p, &p[len + 1]);        /* Copy from next \0 or  : */
+               memmove (p, &p[len + 1], strlen (&p[len + 1]) + 1);     /* Copy from next \0 or  : */
              }
            p = strchr (p, DIRNAME_SEPARATOR);
            if (p != 0)