sed: avoid crash when rregexec return error

This commit is contained in:
Russ Cox 2009-02-04 20:13:18 -08:00
parent 1adb2a07bf
commit ee85defda4

View file

@ -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;