Hello all,

The ip() function in VMOD std currently fails an assertion when there is
insufficient workspace: p = WS_Alloc(); AN(p)

With the attached patch, it emits an error message to the log using
VCL_Error and returns the fallback when this happens.


Best,
Geoff
-- 
** * * UPLEX - Nils Goroll Systemoptimierung

Scheffelstraße 32
22301 Hamburg

Tel +49 40 2880 5731
Mob +49 176 636 90917
Fax +49 40 42949753

http://uplex.de
From 54061934ad87f692ed4a2edc42825bf74b745ecf Mon Sep 17 00:00:00 2001
From: Geoff Simmons <[email protected]>
Date: Sun, 24 May 2015 21:34:25 +0200
Subject: [PATCH] std.ip() emits an error to the log and returns the fallback
 when there is insufficient workspace

---
 lib/libvmod_std/vmod_std_conversions.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c
index 57889b0..95bb003 100644
--- a/lib/libvmod_std/vmod_std_conversions.c
+++ b/lib/libvmod_std/vmod_std_conversions.c
@@ -140,7 +140,11 @@ vmod_ip(VRT_CTX, VCL_STRING s, VCL_IP d)
 	assert(VSA_Sane(d));
 
 	p = WS_Alloc(ctx->ws, vsa_suckaddr_len);
-	AN(p);
+	if (p == NULL) {
+		VSLb(ctx->vsl, SLT_VCL_Error,
+		     "vmod std.ip(): insufficient workspace");
+		return d;
+	}
 	r = NULL;
 
 	if (s != NULL) {
-- 
1.7.10.4

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to