aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/patch/patch.c
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2017-11-03 17:04:30 +0000
committerKyle Evans <kevans@FreeBSD.org>2017-11-03 17:04:30 +0000
commited3b30599370432f6ac501e36099f597f5999d27 (patch)
treed198e1aadab82d34cb623882e83022bcdea3970d /usr.bin/patch/patch.c
parent8584ed54ab8a7b1dc8c0d12c320beafc1286306d (diff)
Notes
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r--usr.bin/patch/patch.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index 24e09ed304ad..204b1146b94c 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1026,6 +1026,9 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz)
const char *plineptr;
unsigned short plinelen;
+ /* Patch does not match if we don't have anymore context to use */
+ if (pline > pat_lines)
+ return false;
for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) {
ilineptr = ifetch(iline, offset >= 0);
if (ilineptr == NULL)