diff options
author | Sami Kerola <kerolasa@iki.fi> | 2011-01-17 00:27:06 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-01-17 19:07:58 +0100 |
commit | aa9f02bc30c58ab3ec20d243b3cc7c24918bad37 (patch) | |
tree | 8f958963babd0dbcb56f46912e6ded7023b1040e /src | |
parent | 442b068ac1573ae00fdf029ddb77b35fdcdf8fc0 (diff) | |
download | coreutils-aa9f02bc30c58ab3ec20d243b3cc7c24918bad37.tar.xz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/uniq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/uniq.c b/src/uniq.c index 7bdbc4f86..9c7e37c7b 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -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++; |