int
re_stream_exec(struct stream_re *sre, char *sub, int slen)
{
- int match, flags, newlen, start, end;
+ int match, strcount, flags, newlen, start, end;
if (sre->state == -1) {
flags = PCRE_PARTIAL | PCRE_DFA_RESTART;
sre->result = reallocf(sre->result, sre->ralloc);
if (!sre->result) return -1;
}
- pcre_copy_substring(sub, sre->ovec, match, 0,
+
+ strcount = match;
+ if (match == PCRE_ERROR_PARTIAL) strcount = 1;
+ pcre_copy_substring(sub, sre->ovec, strcount, 0,
sre->result + sre->rlen,
sre->ralloc - sre->rlen);
sre->rlen = newlen;