From: Daniel Stenberg Date: Mon, 1 Oct 2007 22:51:38 +0000 (+0000) Subject: Prevent ares_strerror() from segfaulting if an invalid error code is passed X-Git-Tag: curl-7_17_1~145 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbd4abf0ff534013f998271250434a9df12de353;p=curl Prevent ares_strerror() from segfaulting if an invalid error code is passed in as argument! --- diff --git a/ares/ares_strerror.c b/ares/ares_strerror.c index 3486ebfbb..ce2edb192 100644 --- a/ares/ares_strerror.c +++ b/ares/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))); - return errtext[code]; + if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) + return errtext[code]; + else + return "unknown"; }