From 46d039e0e111b78e3346b886eff7b4f36e89be18 Mon Sep 17 00:00:00 2001 From: Pavel Tsekov Date: Wed, 2 May 2007 11:22:01 +0000 Subject: [PATCH] * edit/editcmd.c (edit_find_string): Fix an off-by-one error when matching against a RE. --- edit/ChangeLog | 5 +++++ edit/editcmd.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index ca68e55a6..3eaac6623 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,8 @@ +2007-05-02 Pavel Tsekov + + * editcmd.c (edit_find_string): Fix an off-by-one error when matching + against a RE. + 2007-04-27 Pavel Tsekov * editcmd.c (edit_replace_cmd): Disable scanf-printf replacement diff --git a/edit/editcmd.c b/edit/editcmd.c index 1f7c13dfb..47848a006 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -1559,10 +1559,11 @@ edit_find_string (long start, unsigned char *exp, int *len, long last_byte, edit } for (; p < last_byte && q < MAX_REPL_LEN; p++, q++) { mbuf[q] = (*get_byte) (data, p); - if (mbuf[q] == '\n') + if (mbuf[q] == '\n') { + q++; break; + } } - q++; offset += q; mbuf[q] = 0;