]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Corrupted path caused by "cd" command.
authorJoel Brobecker <brobecker@gnat.com>
Wed, 25 Apr 2012 15:14:59 +0000 (15:14 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 25 Apr 2012 15:14:59 +0000 (15:14 +0000)
gdb/ChangeLog:

* cli/cli-cmds.c (cd_command): Use memmove instead of strcpy.

gdb/ChangeLog
gdb/cli/cli-cmds.c

index df4bacfc490d6abb6f640341485917dd77d2181f..c7025b58872641463e1bce49c68f04cb17fdbbd5 100644 (file)
        (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
index 7513ee41d079a1ebfd921ea1bd39f1078f26663e..2968662ab312198ff2037c59433c348fbc5ed147 100644 (file)
@@ -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;
                }
            }