tsed: avoid crash when rregexec return error - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ee85defda48d1d6b7c18b9fab7140c6598d2f658
(DIR) parent 1adb2a07bff16932f070a29af8460c35be34fb65
(HTM) Author: Russ Cox <rsc@swtch.com>
Date: Wed, 4 Feb 2009 20:13:18 -0800
sed: avoid crash when rregexec return error
Diffstat:
M src/cmd/sed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/src/cmd/sed.c b/src/cmd/sed.c
t@@ -994,7 +994,7 @@ match(Reprog *pattern, Rune *buf)
return 0;
subexp[0].s.rsp = buf;
subexp[0].e.rep = 0;
- if (rregexec(pattern, linebuf, subexp, MAXSUB)) {
+ if (rregexec(pattern, linebuf, subexp, MAXSUB) > 0) {
loc1 = subexp[0].s.rsp;
loc2 = subexp[0].e.rep;
return 1;