summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-02-21 10:31:21 +0100
committerGitHub <noreply@github.com>2019-02-21 10:31:21 +0100
commit554b3b9aa594e5df6273115dbee8f6035837120b (patch)
treed31f64fae9f5668c4b8ff7efa05e507de187658a /src
parent6eb4947d05ddb586cb89c38d3199daf6752c3c78 (diff)
parent966b944095edf9910a332bb73249b5d7d6ebeb2f (diff)
downloadlibgit2-554b3b9aa594e5df6273115dbee8f6035837120b.tar.gz
Merge pull request #4996 from eaigner/master
Prevent reading out of bounds memory
Diffstat (limited to 'src')
-rw-r--r--src/apply.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/apply.c b/src/apply.c
index d72aa8374..0becf9495 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -59,7 +59,7 @@ static int patch_image_init_fromstr(
git_pool_init(&out->pool, sizeof(git_diff_line));
for (start = in; start < in + in_len; start = end) {
- end = memchr(start, '\n', in_len);
+ end = memchr(start, '\n', in_len - (start - in));
if (end == NULL)
end = in + in_len;