mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-28 04:24:45 +08:00
uniq: don't continue field processing after end of line
* NEWS (Bug fixes): Mention it. * src/uniq.c (find_field): Stop processing loop when end of line is reached. Before this fix, 'uniq -f 10000000000 /etc/passwd' would run for a very long time.
This commit is contained in:
parent
442b068ac1
commit
aa9f02bc30
2
NEWS
2
NEWS
@ -13,6 +13,8 @@ GNU coreutils NEWS -*- outline -*-
|
||||
rm -f no longer fails for EINVAL or EILSEQ on file systems that
|
||||
reject file names invalid for that file system.
|
||||
|
||||
uniq -f NUM no longer tries to process fields after end of line.
|
||||
|
||||
|
||||
* Noteworthy changes in release 8.9 (2011-01-04) [stable]
|
||||
|
||||
|
@ -214,7 +214,7 @@ find_field (struct linebuffer const *line)
|
||||
size_t size = line->length - 1;
|
||||
size_t i = 0;
|
||||
|
||||
for (count = 0; count < skip_fields; count++)
|
||||
for (count = 0; count < skip_fields && i < size; count++)
|
||||
{
|
||||
while (i < size && isblank (to_uchar (lp[i])))
|
||||
i++;
|
||||
|
Loading…
Reference in New Issue
Block a user