From 6d85e39be1690c85a4286b75e0c9e141d242fb8d Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Wed, 3 Jul 2013 22:46:30 +0000 Subject: [PATCH] Merge r252513 from src/gnu/usr.bin/patch into src/usr.bin/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. --- usr.bin/patch/pch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index c4792b203540..c6224e7f234c 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1204,7 +1204,7 @@ pgets(bool do_indent) indent++; } } - strncpy(buf, line, len - skipped); + memcpy(buf, line, len - skipped); buf[len - skipped] = '\0'; } return len;