From a559a5a94fc7d293c70329b023cd17a19a66978f Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Tue, 2 Jul 2013 17:17:42 +0000 Subject: [PATCH] Properly handle input lines containing NUL characters such that pgets() accurately fills the read buffer. Callers of pgets() still mis-process the buffer contents if the read line contains NUL characters, but this at least makes pgets() accurate. --- gnu/usr.bin/patch/pch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c index e2c9548a808b..37bbe56b357e 100644 --- a/gnu/usr.bin/patch/pch.c +++ b/gnu/usr.bin/patch/pch.c @@ -1181,7 +1181,7 @@ pgets(bool do_indent) indent++; } } - Strncpy(buf, line, len - skipped); + memcpy(buf, line, len - skipped); buf[len - skipped] = '\0'; } return len;