Skip to content

Commit 581a4d3

Browse files
author
Edward Thomson
committed
apply: safety check files that dont end with eol
1 parent c065f6a commit 581a4d3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/apply.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ static int patch_image_init_fromstr(
5353
for (start = in; start < in + in_len; start = end) {
5454
end = memchr(start, '\n', in_len);
5555

56-
if (end < in + in_len)
56+
if (end == NULL)
57+
end = in + in_len;
58+
59+
else if (end < in + in_len)
5760
end++;
5861

5962
line = git_pool_mallocz(&out->pool, 1);

0 commit comments

Comments
 (0)