[hackers] [sbase] [PATCH 1/3] ed: Don't match against line 0 in search()

From: Wolfgang Corcoran-Mathe <wcm_AT_sigwinch.xyz>
Date: Sun, 24 Jul 2016 21:04:27 -0400

regexec(3) happily matches /^$/ against the text of line
zero (the null string), causing an error.

Also update email address for Wolfgang Corcoran-Mathe
---
 LICENSE | 2 +-
 ed.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/LICENSE b/LICENSE
index 6c0fc52..c86f70d 100644
--- a/LICENSE
+++ b/LICENSE
_AT_@ -58,6 +58,6 @@ Authors/contributors include:
 © 2015 Tai Chi Minh Ralph Eastwood <tcmreastwood_AT_gmail.com>
 © 2015 Quentin Rameau <quinq_AT_quinq.eu.org>
 © 2015 Dionysis Grigoropoulos <info_AT_erethon.com>
-© 2015 Wolfgang Corcoran-Mathe <first.lord.of.teal_AT_gmail.com>
+© 2015 Wolfgang Corcoran-Mathe <wcm_AT_sigwinch.xyz>
 © 2016 Mattias Andrée <maandree_AT_kth.se>
 © 2016 Eivind Uggedal <eivind_AT_uggedal.com>
diff --git a/ed.c b/ed.c
index ce19cf7..e41fbdd 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -426,7 +426,7 @@ search(int way)
 	i = curln;
 	do {
 		i = (way == '?') ? prevln(i) : nextln(i);
-		if (match(i))
+		if (i > 0 && match(i))
 			return i;
 	} while (i != curln);
 
-- 
2.9.0
Received on Mon Jul 25 2016 - 03:04:27 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 25 2016 - 03:12:15 CEST