apply: safety check files that dont end with eol
diff --git a/src/apply.c b/src/apply.c
index e982ab6..40ba647 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -53,7 +53,10 @@ static int patch_image_init_fromstr(
for (start = in; start < in + in_len; start = end) {
end = memchr(start, '\n', in_len);
- if (end < in + in_len)
+ if (end == NULL)
+ end = in + in_len;
+
+ else if (end < in + in_len)
end++;
line = git_pool_mallocz(&out->pool, 1);