summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2007-09-05 23:37:02 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-09-05 23:37:02 -0700
commit7e2e69b7f67ba8b336be56508d0208117d9e22e3 (patch)
treef10cda2462596cb0939c5dd0d0373bff5a2aaee0 /builtin-apply.c
parentMerge branch 'ds/sendmail' (diff)
parentInclude a git-push example for creating a remote branch (diff)
downloadtgif-7e2e69b7f67ba8b336be56508d0208117d9e22e3.tar.xz
Merge branch 'maint'
* maint: Include a git-push example for creating a remote branch Cleanup unnecessary file modifications in t1400-update-ref Makefile: Add cache-tree.h to the headers list Don't allow contrib/workdir/git-new-workdir to trash existing dirs git-apply: do not read past the end of buffer
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 25b1447901..976ec77041 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1514,7 +1514,8 @@ static int find_offset(const char *buf, unsigned long size, const char *fragment
}
/* Exact line number? */
- if (!memcmp(buf + start, fragment, fragsize))
+ if ((start + fragsize <= size) &&
+ !memcmp(buf + start, fragment, fragsize))
return start;
/*