aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-05-07 03:09:00 -0400
committerJesse Luehrs <doy@tozt.net>2014-05-07 03:09:00 -0400
commit26e1ede47e62fe80c8b899847e5205cd60f130a9 (patch)
treeb99aba4c0805537ceadf758e52e1ee44ad219318
parent24cdab0ff9c4747a15f8d13acf8cca9d27cf296c (diff)
downloadrunes-26e1ede47e62fe80c8b899847e5205cd60f130a9.tar.gz
runes-26e1ede47e62fe80c8b899847e5205cd60f130a9.zip
fix invalid memory writes
-rw-r--r--src/screen.c6
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));
}
}