qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs buffer.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs buffer.c
Date: Wed, 26 Dec 2007 09:49:52 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        07/12/26 09:49:52

Modified files:
        .              : buffer.c 

Log message:
        prevent potential buffer overflow

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.25&r2=1.26

Patches:
Index: buffer.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/buffer.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- buffer.c    21 Dec 2007 22:34:31 -0000      1.25
+++ buffer.c    26 Dec 2007 09:49:52 -0000      1.26
@@ -1709,10 +1709,12 @@
         mode = st.st_mode & 0777;
 
     /* backup old file if present */
+    if (strlen(filename) < MAX_FILENAME_SIZE - 1) {
     strcpy(buf1, filename);
     strcat(buf1, "~");
     // should check error code
     rename(filename, buf1);
+    }
 
     ret = b->data_type->buffer_save(b, 0, b->total_size, filename);
     if (ret < 0)




reply via email to

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