0014-tload: Prevent a buffer overflow when row equals nrows.
When max_scale is very small, scale_fact is very small, row is equal to nrows, p points outside screen, and the write to *p is out-of-bounds.
This commit is contained in:
parent
44593c5e99
commit
44d5a5689c
2
tload.c
2
tload.c
@ -189,7 +189,7 @@ int main(int argc, char **argv)
|
|||||||
for (i = 1;; ++i) {
|
for (i = 1;; ++i) {
|
||||||
char *p;
|
char *p;
|
||||||
row = nrows - (i * scale_fact);
|
row = nrows - (i * scale_fact);
|
||||||
if (row < 0)
|
if (row < 0 || row >= nrows)
|
||||||
break;
|
break;
|
||||||
if (*(p = screen + row * ncols + col) == ' ')
|
if (*(p = screen + row * ncols + col) == ' ')
|
||||||
*p = '-';
|
*p = '-';
|
||||||
|
Loading…
Reference in New Issue
Block a user