Skip to content

Commit 27a63fb

Browse files
committed
Fix seg fault in json parser
1 parent f329ce8 commit 27a63fb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
Windows build is included it only covers recent 64-bit Windows. More
1717
work is need for older Windows variants. (#250).
1818
- Increase maximum allowed schema file size from 64 KiB to 1 MB (#256).
19-
19+
- Fix seg fault in json parser while adding null characters to a too
20+
short input string for a fixed length char array struct field (#257).
2021

2122
## [0.6.1]
2223

src/runtime/json_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ const char *flatcc_json_parser_char_array(flatcc_json_parser_t *ctx,
879879
if (ctx->flags & flatcc_json_parser_f_reject_array_underflow) {
880880
return flatcc_json_parser_set_error(ctx, buf, end, flatcc_json_parser_error_array_underflow);
881881
}
882-
memset(s, 0, n - k);
882+
memset(s, 0, n);
883883
}
884884
return flatcc_json_parser_string_end(ctx, buf, end);
885885
}

0 commit comments

Comments
 (0)