From: Adam Dickmeiss Date: Fri, 24 Feb 2012 10:26:56 +0000 (+0100) Subject: CCL: ccl_err_msg returns 0 ptr for invalid ccl_errno X-Git-Tag: v4.2.27~6 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=97d7fdb61597302d861480d4bc7455d4bb1b08cb;p=yaz-moved-to-github.git CCL: ccl_err_msg returns 0 ptr for invalid ccl_errno --- diff --git a/src/cclerrms.c b/src/cclerrms.c index e9b6a87..b0cafc1 100644 --- a/src/cclerrms.c +++ b/src/cclerrms.c @@ -35,7 +35,11 @@ static char *err_msg_array[] = { const char *ccl_err_msg(int ccl_errno) { - return err_msg_array[ccl_errno]; + if (ccl_errno >= 0 && + ccl_errno < sizeof(err_msg_array)/sizeof(*err_msg_array)) + return err_msg_array[ccl_errno]; + else + return 0; } /* * Local variables: