emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src ChangeLog fileio.c


From: Chong Yidong
Subject: [Emacs-diffs] emacs/src ChangeLog fileio.c
Date: Tue, 07 Jul 2009 22:53:00 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/07/07 22:52:59

Modified files:
        src            : ChangeLog fileio.c 

Log message:
        * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory)
        (Fexpand_file_name): Copy string data properly (Bug#3772).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7633&r2=1.7634
http://cvs.savannah.gnu.org/viewcvs/emacs/src/fileio.c?cvsroot=emacs&r1=1.654&r2=1.655

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7633
retrieving revision 1.7634
diff -u -b -r1.7633 -r1.7634
--- ChangeLog   7 Jul 2009 08:38:44 -0000       1.7633
+++ ChangeLog   7 Jul 2009 22:52:58 -0000       1.7634
@@ -1,3 +1,8 @@
+2009-07-07  Chong Yidong  <address@hidden>
+
+       * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory)
+       (Fexpand_file_name): Copy string data properly (Bug#3772).
+
 2009-07-07  Jan Djärv  <address@hidden>
 
        * xterm.c (handle_one_xevent): Only call x_check_fullscreen on the

Index: fileio.c
===================================================================
RCS file: /sources/emacs/emacs/src/fileio.c,v
retrieving revision 1.654
retrieving revision 1.655
diff -u -b -r1.654 -r1.655
--- fileio.c    15 Apr 2009 00:08:24 -0000      1.654
+++ fileio.c    7 Jul 2009 22:52:59 -0000       1.655
@@ -422,9 +422,11 @@
     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 @@
        }
     }
 
-  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.  */
@@ -1641,11 +1642,12 @@
   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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]