summaryrefslogtreecommitdiff
path: root/t/t4123-apply-shrink.sh
AgeCommit message (Collapse)AuthorFilesLines
2007-09-05git-apply: do not read past the end of bufferLibravatar Junio C Hamano1-0/+58
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>