sandy

text editor
git clone git://git.suckless.org/sandy
Log | Files | Refs | README | LICENSE

commit 224751025558c4bab5666deddc86d11f315d215a
parent c181aed529846277dfbc8d771b059ca732ad8089
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun, 27 Jul 2014 13:47:58 +0000

fix possible out-of-bounds if size of fgcolors > bgcolors

+ the color initialization was also wrong?

Diffstat:
sandy.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 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]; }