From 97d7fdb61597302d861480d4bc7455d4bb1b08cb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 24 Feb 2012 11:26:56 +0100 Subject: [PATCH] CCL: ccl_err_msg returns 0 ptr for invalid ccl_errno --- src/cclerrms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- 1.7.10.4