[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH] avoid writing uninitialized bytes to the lock file
From: |
Kamil Dudka |
Subject: |
[Nano-devel] [PATCH] avoid writing uninitialized bytes to the lock file |
Date: |
Mon, 26 Jan 2015 15:04:48 +0100 |
The call to null_at() would not initialize the buffer:
Syscall param write(buf) points to uninitialised byte(s)
at 0x3EA76F0EB0: __write_nocancel (syscall-template.S:81)
by 0x3EA767949C: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1302)
by 0x3EA767A948: new_do_write (fileops.c:537)
by 0x3EA767A948: _IO_do_write@@GLIBC_2.2.5 (fileops.c:510)
by 0x3EA767A22F: _IO_file_close_it@@GLIBC_2.2.5 (fileops.c:166)
by 0x3EA766E2C1: fclose@@GLIBC_2.2.5 (iofclose.c:59)
by 0x40814C: write_lockfile (files.c:221)
by 0x40847C: do_lockfile (files.c:314)
by 0x40BC5E: open_buffer (files.c:351)
by 0x4041D7: main (nano.c:2761)
Address 0x4c1900c is not stack'd, malloc'd or (recently) free'd
---
trunk/nano/src/files.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/trunk/nano/src/files.c b/trunk/nano/src/files.c
index 3ac53d8..90c6b0c 100644
--- a/trunk/nano/src/files.c
+++ b/trunk/nano/src/files.c
@@ -195,7 +195,7 @@ int write_lockfile(const char *lockfilename, const char
*origfilename, bool modi
* our lockfile' message in here...
*
* This is likely very wrong, so this is a WIP. */
- null_at(&lockdata, lockdatalen);
+ memset(lockdata, 0, lockdatalen);
lockdata[0] = 0x62;
lockdata[1] = 0x30;
lockdata[24] = mypid % 256;
--
2.1.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nano-devel] [PATCH] avoid writing uninitialized bytes to the lock file,
Kamil Dudka <=