diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-04-25 15:14:59 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-04-25 15:14:59 +0000 |
commit | b2a3b50908b8bfc54f21abfba0c351a41d6ef65f (patch) | |
tree | 3e9c131621c47fbe267ca1935d1f89b32590bcf4 /gdb/cli | |
parent | a766d390bb857383a5f9ae80a102e1f8705f4c2e (diff) | |
download | gdb-b2a3b50908b8bfc54f21abfba0c351a41d6ef65f.zip gdb-b2a3b50908b8bfc54f21abfba0c351a41d6ef65f.tar.gz gdb-b2a3b50908b8bfc54f21abfba0c351a41d6ef65f.tar.bz2 |
Corrupted path caused by "cd" command.
gdb/ChangeLog:
* cli/cli-cmds.c (cd_command): Use memmove instead of strcpy.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-cmds.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 7513ee4..2968662 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -417,7 +417,7 @@ cd_command (char *dir, int from_tty) { if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && (p[2] == 0 || IS_DIR_SEPARATOR (p[2]))) - strcpy (p, p + 2); + memmove (p, p + 2, strlen (p + 2) + 1); else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.' && (p[3] == 0 || IS_DIR_SEPARATOR (p[3]))) { @@ -436,7 +436,7 @@ cd_command (char *dir, int from_tty) ++p; else { - strcpy (q - 1, p + 3); + memmove (q - 1, p + 3, strlen (p + 3) + 1); p = q - 1; } } |