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 | |
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.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/cli/cli-cmds.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index df4bacf..c7025b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -111,6 +111,10 @@ (mips_o32_return_value): Likewise. (mips_o64_return_value): Likewise. +2012-04-25 Fredrik Hederstierna <fredrikh.hederstierna@securitas-direct.com> + + * cli/cli-cmds.c (cd_command): Use memmove instead of strcpy. + 2012-04-21 Paul Hilfinger <hilfinger@adacore.com> * ada-lang.c (ada_evaluate_subexp): Add cases for 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; } } |