]> git.wh0rd.org Git - nano.git/commitdiff
Making sure that 'lockprog' and 'lockuser' are properly terminated.
authorBenno Schulenberg <bensberg@justemail.net>
Sun, 1 Feb 2015 09:48:50 +0000 (09:48 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Sun, 1 Feb 2015 09:48:50 +0000 (09:48 +0000)
Patch by Kamil Dudka.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5109 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index 74e735bbfa0103b8f8a0fb5f442a06e52250c946..7bd3095ef7adb7653a1f85a3f98ea7a7b1ffa678 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2015-02-01  Kamil Dudka  <kdudka@redhat.com>
        * src/files.c (write_lockfile): Avoid writing uninitialized bytes to
        the lock file -- a simple null_at() would not initialize the buffer.
+       * src/files.c (do_lockfile): Make sure that 'lockprog' and 'lockuser'
+       are terminated -- strncpy() does not guarantee that on its own.
 
 2015-02-01  Benno Schulenberg  <bensberg@justemail.net>
        * src/winio.c (do_credits): Add a general entry for all translators.
index 90c6b0cc5f198911400816871d5408ccf8e7fea1..cbe46aee7070dc8fa6655f6540f6326cbb80d77e 100644 (file)
@@ -253,7 +253,7 @@ int do_lockfile(const char *filename)
                + strlen(locking_suffix) + 3;
     char *lockfilename = charalloc(lockfilesize);
     char *lockfiledir = NULL;
-    char lockprog[12], lockuser[16];
+    static char lockprog[11], lockuser[17];
     struct stat fileinfo;
     int lockfd, lockpid;