diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-05-07 03:09:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-05-07 03:09:00 -0400 |
commit | 26e1ede47e62fe80c8b899847e5205cd60f130a9 (patch) | |
tree | b99aba4c0805537ceadf758e52e1ee44ad219318 | |
parent | 24cdab0ff9c4747a15f8d13acf8cca9d27cf296c (diff) | |
download | runes-26e1ede47e62fe80c8b899847e5205cd60f130a9.tar.gz runes-26e1ede47e62fe80c8b899847e5205cd60f130a9.zip |
fix invalid memory writes
-rw-r--r-- | src/screen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/screen.c b/src/screen.c index 923f8ee..57b536d 100644 --- a/src/screen.c +++ b/src/screen.c @@ -55,10 +55,10 @@ void runes_screen_set_window_size(RunesTerm *t) scr->grid->rows[i].cells = realloc( scr->grid->rows[i].cells, scr->grid->max.col * sizeof(struct runes_cell)); - if (old_size.col > scr->grid->max.col) { + if (old_size.col < scr->grid->max.col) { memset( - &scr->grid->rows[i].cells[scr->grid->max.col], 0, - (old_size.col - scr->grid->max.col) * sizeof(struct runes_cell)); + &scr->grid->rows[i].cells[old_size.col], 0, + (scr->grid->max.col - old_size.col) * sizeof(struct runes_cell)); } } |