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, ...@@ -150,11 +150,13 @@ match(VRT_CTX, vre2 * restrict vre2, VCL_STRING restrict subject,
snap = WS_Snapshot(ctx->ws); snap = WS_Snapshot(ctx->ws);
if (!never_capture) { if (!never_capture) {
ngroups++; ngroups++;
if ((text = WS_Copy(ctx->ws, subject, len + 1)) == NULL) { if (!WS_Inside(ctx->ws, subject, subject + len + 1))
VERR(ctx, ERR_PREFIX "insufficient workspace to copy " if ((text = WS_Copy(ctx->ws, subject, len + 1))
"subject", subject); == NULL) {
return 0; VERR(ctx, ERR_PREFIX "insufficient workspace "
} "to copy subject", subject);
return 0;
}
if ((*groups = WS_Alloc(ctx->ws, ngroups * match_sz)) if ((*groups = WS_Alloc(ctx->ws, ngroups * match_sz))
== NULL) { == NULL) {
VERR(ctx, ERR_PREFIX "insufficient workspace to " 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