From dbd4abf0ff534013f998271250434a9df12de353 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 1 Oct 2007 22:51:38 +0000 Subject: Prevent ares_strerror() from segfaulting if an invalid error code is passed in as argument! --- ares/ares_strerror.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ares') 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"; } -- cgit v1.2.3