Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory safety issues #260

Merged
merged 10 commits into from
Jan 6, 2022
Prev Previous commit
Next Next commit
ucl_parse_value: fix out-of-bounds read
If the string ends with a Multiline terminator without a newline, the
function tried to read the next character to check for a newline without
checking if the pointer was past the end of the buffer. This commit adds
a bounds check and return early with an error in case of missing
newline.

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21579
  • Loading branch information
alpire committed Jan 4, 2022
commit 08de3581e8bc1ca855cf96061583363b8570215e
5 changes: 5 additions & 0 deletions src/ucl_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,11 @@ ucl_parse_value (struct ucl_parser *parser, struct ucl_chunk *chunk)
while (p < chunk->end && *p >= 'A' && *p <= 'Z') {
p ++;
}
if(p == chunk->end) {
ucl_set_err (parser, UCL_ESYNTAX,
"unterminated multiline value", &parser->err);
return false;
}
if (*p =='\n') {
/* Set chunk positions and start multiline parsing */
chunk->remain -= p - c + 1;
Expand Down