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
This commit is contained in:
@@ -74,7 +74,7 @@ const char* json_tokener_errors[] = {
|
|||||||
const char *json_tokener_error_desc(enum json_tokener_error jerr)
|
const char *json_tokener_error_desc(enum json_tokener_error jerr)
|
||||||
{
|
{
|
||||||
int jerr_int = (int)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 "Unknown error, invalid json_tokener_error value passed to json_tokener_error_desc()";
|
||||||
return json_tokener_errors[jerr];
|
return json_tokener_errors[jerr];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user