Prevent ares_strerror() from segfaulting if an invalid error code is passed

in as argument!
pull/1/head
Daniel Stenberg 17 years ago
parent 10df4bdba2
commit 250e7c4020
  1. 4
      ares_strerror.c

@ -46,6 +46,8 @@ const char *ares_strerror(int code)
"Illegal hints flags specified"
};
DEBUGASSERT(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)));
if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)))
return errtext[code];
else
return "unknown";
}

Loading…
Cancel
Save