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:
parent
07b3f0f7db
commit
a559a5a94f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user