summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2013-09-08 13:20:08 -0700
committerEric Haszlakiewicz <erh+git@nimenees.com>2013-09-08 13:20:08 -0700
commitbd42b8310de27207665bc0cd5fe358e91d97838c (patch)
tree825a3c4c685181307d105168ad8481e8e8cb0033
parentb3bce4d5943774b59d7fa653da89f48db70d013e (diff)
parent86dd55a74a6634a1018feac7f5ef5579d033ce2a (diff)
Merge pull request #104 from rouault/fix_json_tokener_error_desc_out_of_bounds_read
Fix potential out-of-bounds read in json_tokener_error_desc
-rw-r--r--json_tokener.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/json_tokener.c b/json_tokener.c
index a6924a1..7b3a097 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -74,7 +74,7 @@ const char* json_tokener_errors[] = {
const char *json_tokener_error_desc(enum json_tokener_error jerr)
{
int jerr_int = (int)jerr;
- if (jerr_int < 0 || jerr_int > (int)sizeof(json_tokener_errors))
+ if (jerr_int < 0 || jerr_int > (int)(sizeof(json_tokener_errors) / sizeof(json_tokener_errors[0])))
return "Unknown error, invalid json_tokener_error value passed to json_tokener_error_desc()";
return json_tokener_errors[jerr];
}