]> granicus.if.org Git - json-c/commitdiff
Fix Issue #111: Fix off-by-one error when range checking the input to json_tokener_er...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Wed, 12 Feb 2014 04:16:53 +0000 (23:16 -0500)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Wed, 12 Feb 2014 04:16:53 +0000 (23:16 -0500)
json_tokener.c

index a2a598b1a1e01c9885886c284dd7fa31f758916c..4ebe71208498fafa42ce428d2fe280d55157ade2 100644 (file)
@@ -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) / sizeof(json_tokener_errors[0])))
+       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];
 }