1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-21 02:49:08 +02:00
Commit Graph

1 Commits

Author SHA1 Message Date
Junio C Hamano 6b763c424e git-apply: do not read past the end of buffer
When the preimage we are patching is shorter than what the patch
text expects, we tried to match the buffer contents at the
"original" line with the fragment in full, without checking we
have enough data to match in the preimage.  This caused the size
of a later memmove() to wrap around and attempt to scribble
almost the entire address space.  Not good.

The code that follows the part this patch touches tries to match
the fragment with line offsets.  Curiously, that code does not
have the problem --- it guards against reading past the end of
the preimage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 21:58:40 -07:00