ref: 91ec74f2d90126689bcef9e0a0ade95982a53943
parent: 8e4b6f767689d4afc1fc7e365f0c4a6a4a17391e
author: Michael Forney <mforney@mforney.org>
date: Sat Oct 22 15:13:28 EDT 2022
patch: fix bounds check for hunk scan in forward direction Previously, hunks that end exactly at the end of the file could not be found when the matching lines were located at a positive offset.
--- a/sys/src/cmd/patch.c
+++ b/sys/src/cmd/patch.c
@@ -528,7 +528,7 @@
ln = h->oldln + fuzz + 1;
if(ln > f->lastln && ln < f->nlines){
off = f->lines[ln];
- if(off + len >= f->len)
+ if(off + len > f->len)
continue;
scanning = 1;
if(memcmp(f->buf + off, h->old, h->oldlen) == 0){
--
⑨