mirror of
https://github.com/json-c/json-c.git
synced 2026-03-16 19:49:07 +08:00
Merge pull request #655 from MarcT512/issue654
json_parse: Fix read past end of buffer
This commit is contained in:
@@ -82,7 +82,8 @@ static int parseit(int fd, int (*callback)(struct json_object *))
|
||||
int parse_end = json_tokener_get_parse_end(tok);
|
||||
if (obj == NULL && jerr != json_tokener_continue)
|
||||
{
|
||||
char *aterr = &buf[start_pos + parse_end];
|
||||
char *aterr = (start_pos + parse_end < sizeof(buf)) ?
|
||||
&buf[start_pos + parse_end] : "";
|
||||
fflush(stdout);
|
||||
int fail_offset = total_read - ret + start_pos + parse_end;
|
||||
fprintf(stderr, "Failed at offset %d: %s %c\n", fail_offset,
|
||||
|
||||
Reference in New Issue
Block a user