Commit 6568a2a6 authored by Nils Goroll's avatar Nils Goroll Committed by Pål Hermunn Johansen

vrt_hash_blob: fail gracefully for out-of-workspace conditions

No, we do not want to bring back panics for out-of-ws

Ref: #2402
parent 32ab4bae
......@@ -772,11 +772,17 @@ static struct vmod_priv *
vrt_hash_blob(VRT_CTX, uint8_t *digest)
{
struct vmod_priv *p;
void *d;
p = (void *)WS_Alloc(ctx->ws, sizeof *p);
AN(p);
d = WS_Copy(ctx->ws, digest, DIGEST_LEN);
if (p == NULL || d == NULL) {
VRT_fail(ctx, "Workspace overflow ((be)req.hash)");
return (NULL);
}
memset(p, 0, sizeof *p);
p->len = DIGEST_LEN;
p->priv = WS_Copy(ctx->ws, digest, DIGEST_LEN);
p->priv = d;
return (p);
}
......
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