Skip to content

Commit 1f44079

Browse files
authored
Merge pull request libgit2#5179 from pks-t/pks/patch-parse-free
patch_parse: fix segfault due to line containing static contents
2 parents e07dbc9 + a613832 commit 1f44079

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/patch_parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ static int parse_hunk_body(
653653

654654
memset(line, 0x0, sizeof(git_diff_line));
655655

656-
line->content = ctx->parse_ctx.line;
656+
line->content = git__strdup(ctx->parse_ctx.line);
657657
line->content_len = ctx->parse_ctx.line_len;
658658
line->content_offset = ctx->parse_ctx.content_len - ctx->parse_ctx.remain_len;
659659
line->origin = eof_for_origin(last_origin);

0 commit comments

Comments
 (0)