From 581a4d3942ae5a66933632530fccd65f93ac5e4b Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 14 Jul 2016 23:32:35 -0400 Subject: [PATCH] apply: safety check files that dont end with eol --- src/apply.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apply.c b/src/apply.c index e982ab682..40ba647f4 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);