From 4793e93d6954f1de2473d216a5c40c78f5f67022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 14 Feb 2015 08:50:27 +0100 Subject: [PATCH] Fix two off-by-one errors --- autistdraw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autistdraw.c b/autistdraw.c index 72484f7..2899251 100644 --- a/autistdraw.c +++ b/autistdraw.c @@ -663,7 +663,7 @@ color_to_ansi (uint8_t color) "\033[0;1;7;37m", }; - if (color > sizeof table / sizeof table[0]) + if (color >= sizeof table / sizeof table[0]) return NULL; return table[color]; } @@ -742,7 +742,7 @@ color_to_mirc (uint8_t color) MIRC_L_BLUE, MIRC_L_PURPLE, MIRC_L_CYAN, MIRC_WHITE }; - if (color > sizeof table / sizeof table[0]) + if (color >= sizeof table / sizeof table[0]) return MIRC_NONE; return table[color]; }