From: Tom Tromey Date: Fri, 16 Mar 2012 18:20:34 +0000 (+0000) Subject: 2012-03-16 Chris January X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e16edb4530709c015a185c85c5f501552c4b41d8;p=binutils-gdb.git 2012-03-16 Chris January * source.c (add_path): Use memmove instead of strcpy because the strings overlap. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 706788cf633..473c0fdbc24 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-03-16 Chris January + + * source.c (add_path): Use memmove instead of strcpy because the + strings overlap. + 2012-03-16 Joel Brobecker * value.h (set_value_parent): Add declaration. diff --git a/gdb/source.c b/gdb/source.c index cfdf81b2a00..97f5d46d219 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -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)