Commit 162f55c2 authored by Geoff Simmons's avatar Geoff Simmons

For matches, only copy the subject string if it is not already in workspace.

parent c7583ca9
......@@ -150,11 +150,13 @@ match(VRT_CTX, vre2 * restrict vre2, VCL_STRING restrict subject,
snap = WS_Snapshot(ctx->ws);
if (!never_capture) {
ngroups++;
if ((text = WS_Copy(ctx->ws, subject, len + 1)) == NULL) {
VERR(ctx, ERR_PREFIX "insufficient workspace to copy "
"subject", subject);
return 0;
}
if (!WS_Inside(ctx->ws, subject, subject + len + 1))
if ((text = WS_Copy(ctx->ws, subject, len + 1))
== NULL) {
VERR(ctx, ERR_PREFIX "insufficient workspace "
"to copy subject", subject);
return 0;
}
if ((*groups = WS_Alloc(ctx->ws, ngroups * match_sz))
== NULL) {
VERR(ctx, ERR_PREFIX "insufficient workspace to "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment