mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-01 10:43:32 +00:00
In get_string(), 0-terminate the contents of buf ``just in case'';
otherwise, if the very first fgetc() already yielded EOF, the returned string won't get terminated at all. MFC after: 1 day
This commit is contained in:
parent
7ae71655e7
commit
8a2ecea916
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82471
@ -124,6 +124,7 @@ get_string(int procfd, void *offset, int max) {
|
||||
err(1, "fdopen");
|
||||
buf = malloc( size = (max ? max : 64 ) );
|
||||
len = 0;
|
||||
buf[0] = 0;
|
||||
fseek(p, (long)offset, SEEK_SET);
|
||||
while ((c = fgetc(p)) != EOF) {
|
||||
buf[len++] = c;
|
||||
|
Loading…
Reference in New Issue
Block a user