diff options
author | Ron Yorston <rmy@pobox.com> | 2015-08-04 17:10:37 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-08-16 18:54:49 +0200 |
commit | 26ccd3d062a1949d3fd73b01cdf55e700bde1981 (patch) | |
tree | 0b130cf233750e71331916729bacebea5cc70b62 /networking | |
parent | 72dcbe4df7f02b2176daf70c68835fc8a053a219 (diff) | |
download | busybox-26ccd3d062a1949d3fd73b01cdf55e700bde1981.tar.gz |
less: fix botched attempt to use last column
Commit 1ecb996 attempted to make read_lines() use the last column of
the terminal (as re_wrap() did). There were two problems with this:
- The size of the buffer allocated for lines wasn't increased to allow
for the extra character.
- The test for width overflow was moved after the point where the
next character was added to the buffer. This caused a buffer overflow
in certain circumstances.
For example, if the line beyond the end of the display was wider than
the display read_lines() would initially read the partial line into a
buffer. When the user moved down read_lines() would be called again
to ensure the rest of the line was read. This would place the next
character in the partial line before checking for overflow.
This can be fixed by moving the test for overflow back to where it was
before commit 1ecb996 and changing the comparison to `>` rather than
`>=`.
There are two other places where buffers are created without allowing
for width+1 characters.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
0 files changed, 0 insertions, 0 deletions