Commit 440e2f1a authored by Nils Goroll's avatar Nils Goroll Committed by Pål Hermunn Johansen

Don't panic on a null ban

like ban(req.http.non-existing-header)
parent 11830c5d
......@@ -416,7 +416,11 @@ VRT_ban_string(VRT_CTX, const char *str)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(ctx->vsl);
AN(str);
if (str == NULL) {
VSLb(ctx->vsl, SLT_VCL_Error, "ban(): Null argument");
return;
}
bp = BAN_Build();
if (bp == NULL) {
......
......@@ -11,6 +11,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.method == "PURGE") {
ban(req.http.doesntexist);
ban("");
ban("req.url");
ban("req.url //");
......@@ -31,6 +32,7 @@ client c1 {
} -run
logexpect l1 -v v1 -d 1 -g vxid {
expect * 1004 VCL_Error {ban[(][)]: Null argument}
expect * 1004 VCL_Error {ban[(][)]: No ban conditions found[.]}
expect * 1004 VCL_Error {ban[(][)]: Expected comparison operator[.]}
expect * 1004 VCL_Error {ban[(][)]: Expected second operand[.]}
......
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