mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 19:32:23 +00:00
patch_parse: check if advancing over header newline succeeds
While parsing patch header lines, we iterate over each line and check if the line has trailing garbage. What we do not check though is that the line is actually a line ending with a trailing newline. Fix this by checking the return code of `parse_advance_expected_str`.
This commit is contained in:
parent
8d452448bb
commit
723bdf4864
@ -444,9 +444,9 @@ static int parse_header_git(
|
||||
goto done;
|
||||
|
||||
parse_advance_ws(ctx);
|
||||
parse_advance_expected_str(ctx, "\n");
|
||||
|
||||
if (ctx->line_len > 0) {
|
||||
if (parse_advance_expected_str(ctx, "\n") < 0 ||
|
||||
ctx->line_len > 0) {
|
||||
error = parse_err("trailing data at line %"PRIuZ, ctx->line_num);
|
||||
goto done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user