Browse Source

Fix Issue #111: Fix off-by-one error when range checking the input to json_tokener_error_desc().

tags/json-c-0.12-20140410
Eric Haszlakiewicz 11 years ago
parent
commit
56df93d128
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      json_tokener.c

+ 1
- 1
json_tokener.c View 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];
}


Loading…
Cancel
Save