From: Chong Yidong Date: Tue, 7 Jul 2009 22:48:04 +0000 (+0000) Subject: * fileio.c (Ffile_name_directory, Fexpand_file_name): Copy string data properly ... X-Git-Tag: emacs-pretest-23.0.96~12 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=355906cde732a1916e1578d3d91c69af003d8eb8;p=emacs.git * fileio.c (Ffile_name_directory, Fexpand_file_name): Copy string data properly (Bug#3772). --- diff --git a/src/ChangeLog b/src/ChangeLog index f4767c4c226..deaed0fbc82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,7 @@ 2009-07-07 Chong Yidong - * fileio.c (Fsubstitute_in_file_name): Copy string data - properly (Bug#3772). + * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory) + (Fexpand_file_name): Copy string data properly (Bug#3772). 2009-07-07 Kenichi Handa diff --git a/src/fileio.c b/src/fileio.c index 8529455071f..bf96b3aa2b1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -422,9 +422,11 @@ Given a Unix syntax file name, returns a string ending in slash. */) return call2 (handler, Qfile_name_directory, filename); filename = FILE_SYSTEM_CASE (filename); - beg = SDATA (filename); #ifdef DOS_NT - beg = strcpy (alloca (strlen (beg) + 1), beg); + beg = (unsigned char *) alloca (SBYTES (filename) + 1); + bcopy (SDATA (filename), beg, SBYTES (filename) + 1); +#else + beg = SDATA (filename); #endif p = beg + SBYTES (filename); @@ -939,10 +941,9 @@ filesystem tree, not (expand-file-name ".." dirname). */) } } - nm = SDATA (name); - /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */ - nm = strcpy (alloca (strlen (nm) + 1), nm); + nm = (unsigned char *) alloca (SBYTES (name) + 1); + bcopy (SDATA (name), nm, SBYTES (name) + 1); #ifdef DOS_NT /* Note if special escape prefix is present, but remove for now. */