Fix two off-by-one errors

This commit is contained in:
Přemysl Eric Janouch 2015-02-14 08:50:27 +01:00
parent 829463f8ee
commit 4793e93d69
1 changed files with 2 additions and 2 deletions

View File

@ -663,7 +663,7 @@ color_to_ansi (uint8_t color)
"\033[0;1;7;37m", "\033[0;1;7;37m",
}; };
if (color > sizeof table / sizeof table[0]) if (color >= sizeof table / sizeof table[0])
return NULL; return NULL;
return table[color]; return table[color];
} }
@ -742,7 +742,7 @@ color_to_mirc (uint8_t color)
MIRC_L_BLUE, MIRC_L_PURPLE, MIRC_L_CYAN, MIRC_WHITE 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 MIRC_NONE;
return table[color]; return table[color];
} }