mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
src/sniffer.c: fixes for cppcheck complaints: negativeIndex
This commit is contained in:
@ -364,7 +364,7 @@ static const char* const msgTable[] =
|
|||||||
static void GetError(int idx, char* str)
|
static void GetError(int idx, char* str)
|
||||||
{
|
{
|
||||||
if (str == NULL ||
|
if (str == NULL ||
|
||||||
idx < 0 || idx > (int)(sizeof(msgTable)/sizeof(const char* const)))
|
idx <= 0 || idx > (int)(sizeof(msgTable)/sizeof(const char* const)))
|
||||||
return;
|
return;
|
||||||
XSTRNCPY(str, msgTable[idx - 1], MAX_ERROR_LEN-1);
|
XSTRNCPY(str, msgTable[idx - 1], MAX_ERROR_LEN-1);
|
||||||
str[MAX_ERROR_LEN-1] = '\0';
|
str[MAX_ERROR_LEN-1] = '\0';
|
||||||
|
Reference in New Issue
Block a user