Prevent ares_strerror() from segfaulting if an invalid error code is passed
in as argument!
This commit is contained in:
parent
9ca2644429
commit
dbd4abf0ff
@ -46,6 +46,8 @@ const char *ares_strerror(int code)
|
||||
"Illegal hints flags specified"
|
||||
};
|
||||
|
||||
DEBUGASSERT(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)));
|
||||
return errtext[code];
|
||||
if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)))
|
||||
return errtext[code];
|
||||
else
|
||||
return "unknown";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user