Browse Source

Fix read past end of buffer

Resolves https://github.com/json-c/json-c/issues/654
tags/json-c-0.16-20220414
Marc GitHub 5 years ago
parent
commit
4e9e44e525
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      apps/json_parse.c

+ 2
- 1
apps/json_parse.c View File

@@ -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,


Loading…
Cancel
Save