src/sniffer.c: fixes for cppcheck complaints: negativeIndex

This commit is contained in:
Daniel Pouzzner
2022-01-08 00:27:59 -06:00
parent b69dc00bd7
commit 4d3dfc451d

View File

@ -364,7 +364,7 @@ static const char* const msgTable[] =
static void GetError(int idx, char* str)
{
if (str == NULL ||
idx < 0 || idx > (int)(sizeof(msgTable)/sizeof(const char* const)))
idx <= 0 || idx > (int)(sizeof(msgTable)/sizeof(const char* const)))
return;
XSTRNCPY(str, msgTable[idx - 1], MAX_ERROR_LEN-1);
str[MAX_ERROR_LEN-1] = '\0';