aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/sed.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2009-02-04 20:13:18 -0800
committerRuss Cox <rsc@swtch.com>2009-02-04 20:13:18 -0800
commitee85defda48d1d6b7c18b9fab7140c6598d2f658 (patch)
tree737239578831c526e7a1e0710c35d197fdb9712e /src/cmd/sed.c
parent1adb2a07bff16932f070a29af8460c35be34fb65 (diff)
downloadplan9port-ee85defda48d1d6b7c18b9fab7140c6598d2f658.tar.gz
plan9port-ee85defda48d1d6b7c18b9fab7140c6598d2f658.tar.bz2
plan9port-ee85defda48d1d6b7c18b9fab7140c6598d2f658.zip
sed: avoid crash when rregexec return error
Diffstat (limited to 'src/cmd/sed.c')
-rw-r--r--src/cmd/sed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/sed.c b/src/cmd/sed.c
index a463e071..5849c83f 100644
--- a/src/cmd/sed.c
+++ b/src/cmd/sed.c
@@ -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;