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.
This commit is contained in:
David E. O'Brien 2013-07-03 22:46:30 +00:00
parent 0571fd57a1
commit 6d85e39be1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252637

View File

@ -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;