From: Chong Yidong Date: Tue, 7 Jul 2009 22:26:41 +0000 (+0000) Subject: * fileio.c (Fsubstitute_in_file_name): Copy string data properly. X-Git-Tag: emacs-pretest-23.0.96~14 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0c437eb48ab75570510898837bf7e95ce4c7dae5;p=emacs.git * fileio.c (Fsubstitute_in_file_name): Copy string data properly. --- diff --git a/src/ChangeLog b/src/ChangeLog index 12015414fe7..ab1501af211 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-07-07 Chong Yidong + + * fileio.c (Fsubstitute_in_file_name): Copy string data properly. + 2009-07-07 Kenichi Handa * .gdbinit (xcharset): Fix the treating of $arg0. diff --git a/src/fileio.c b/src/fileio.c index ed5c09bc840..8529455071f 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1641,11 +1641,12 @@ those `/' is discarded. */) if (!NILP (handler)) return call2 (handler, Qsubstitute_in_file_name, filename); - nm = SDATA (filename); /* Always work on a copy of the string, in case GC happens during decode of environment variables, causing the original Lisp_String data to be relocated. */ - nm = strcpy (alloca (strlen (nm) + 1), nm); + nm = (unsigned char *) alloca (SBYTES (filename) + 1); + bcopy (SDATA (filename), nm, SBYTES (filename) + 1); + #ifdef DOS_NT CORRECT_DIR_SEPS (nm); substituted = (strcmp (nm, SDATA (filename)) != 0);