summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2009-07-07 22:26:41 +0000
committerChong Yidong <cyd@stupidchicken.com>2009-07-07 22:26:41 +0000
commit0c437eb48ab75570510898837bf7e95ce4c7dae5 (patch)
tree44c2648c503b28e42914c1d26c620561093101b4
parent90ab959d752256c257e6cd175d10ebf64ae59e0d (diff)
downloademacs-0c437eb48ab75570510898837bf7e95ce4c7dae5.tar.gz
* fileio.c (Fsubstitute_in_file_name): Copy string data properly.
-rw-r--r--src/ChangeLog4
-rw-r--r--src/fileio.c5
2 files changed, 7 insertions, 2 deletions
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 <cyd@stupidchicken.com>
+
+ * fileio.c (Fsubstitute_in_file_name): Copy string data properly.
+
2009-07-07 Kenichi Handa <handa@m17n.org>
* .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);