mirror of
https://github.com/coreutils/coreutils.git
synced 2025-01-21 15:43:30 +08:00
(readtoken): Don't leak 64 bytes when reading an empty input stream.
This commit is contained in:
parent
9fb05110ea
commit
846d81da01
@ -111,13 +111,14 @@ readtoken (FILE *stream,
|
||||
i = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (c < 0 && i == 0)
|
||||
return -1;
|
||||
|
||||
if (i == n)
|
||||
p = x2nrealloc (p, &n, sizeof *p);
|
||||
|
||||
if (c < 0)
|
||||
{
|
||||
if (i == 0)
|
||||
return -1;
|
||||
p[i] = 0;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user