From cca2b5575b295e19043d93e92dbead15c5935d71 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 27 Jul 2014 13:47:58 +0000 Subject: [PATCH 4/5] fix possible out-of-bounds if size of fgcolors > bgcolors + the color initialization was also wrong? --- sandy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sandy.c b/sandy.c index fbe7ad8..0efe201 100644 --- a/sandy.c +++ b/sandy.c @@ -1649,10 +1649,10 @@ i_setup(void) { if(fgcolors[i] > 7) init_color(fgcolors[i], fgcolors[i] >> 8, (fgcolors[i] >> 4) & 0xF, fgcolors[i] & 0xFF); - if(bgcolors[i] > 7) - init_color(bgcolors[i], bgcolors[i] >> 8, (bgcolors[i] >> 4) & 0xF, - bgcolors[i] & 0xFF); + if(bgcolors[j] > 7) + init_color(bgcolors[j], bgcolors[j] >> 8, (bgcolors[j] >> 4) & 0xF, + bgcolors[j] & 0xFF); init_pair((i * LastBG) + j, fgcolors[i], bgcolors[j]); textattrs[i][j] = COLOR_PAIR((i * LastBG) + j) | colorattrs[i]; } -- 2.0.2