hush/miscutils
Ron Yorston 26ccd3d062 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>
2015-08-16 18:54:49 +02:00
..
2015-07-13 03:25:46 +02:00
2015-05-25 13:31:25 +02:00
2013-03-15 00:42:39 +01:00
2014-12-10 13:44:27 +01:00
2015-04-02 23:03:46 +02:00
2011-05-30 23:00:47 +02:00
2015-04-02 23:03:46 +02:00
2013-01-15 13:58:01 +01:00
2013-01-15 13:58:01 +01:00
2015-01-30 18:33:24 +01:00
2015-04-02 23:03:46 +02:00