nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 6bd5dce9543202cfc05a4f9db645da52fbbceb3f
parent f25059c24455a78d3246b5c125b662e9824c23b8
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 30 Jan 2020 20:00:17 +0100

tweaks: ensure that editor name and user name are NUL terminated

When copying those pieces from a lock file, it is not certain that
they end with a NUL character.

Diffstat:
Msrc/files.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -342,9 +342,11 @@ int do_lockfile(const char *filename, bool ask_the_user) } strncpy(lockprog, &lockbuf[2], 10); + lockprog[10] = '\0'; lockpid = (((unsigned char)lockbuf[27] * 256 + (unsigned char)lockbuf[26]) * 256 + (unsigned char)lockbuf[25]) * 256 + (unsigned char)lockbuf[24]; strncpy(lockuser, &lockbuf[28], 16); + lockuser[16] = '\0'; free(lockbuf); pidstring = charalloc(11);