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-02 17:17:42 +00:00
parent 07b3f0f7db
commit a559a5a94f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252513

View File

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