1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-20 09:15:22 +00:00

Avoid memory access errors if llength() overflows

llength() is currently a 'short' which can overflow and result in signed
numbers if line lengths are larger than 32k.  We'll fix the overflow
separately, but before we do that, just use a signed int to hold the
value so that we don't overrun memory allocations when we converted that
negative number to a large positive unsigned integer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2013-02-22 14:29:43 -08:00
parent 8899ed4e1f
commit 25f0141df1

View File

@ -442,7 +442,7 @@ static int reframe(struct window *wp)
static void show_line(struct line *lp)
{
unsigned i = 0, len = llength(lp);
int i = 0, len = llength(lp);
while (i < len) {
unicode_t c;