[3.0] 6a1e3cd Merge rest of a9e5d3
Tollef Fog Heen
tfheen at varnish-cache.org
Mon Apr 22 13:27:00 CEST 2013
commit 6a1e3cd59e63c11ce64d00805d51e19487fb68bb
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date: Thu Apr 4 13:46:05 2013 +0200
Merge rest of a9e5d3
The regression test and sensible error message was missing, so merge
those bits.
diff --git a/bin/varnishtest/tests/r01144.vtc b/bin/varnishtest/tests/r01144.vtc
new file mode 100644
index 0000000..403f77e
--- /dev/null
+++ b/bin/varnishtest/tests/r01144.vtc
@@ -0,0 +1,38 @@
+varnishtest "very long backend names"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ backend fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
+ {
+ .host = "127.0.0.1";
+ .port = "54321";
+ }
+ sub vcl_recv {
+ if (req.url == "never") {
+ set req.backend = fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210;
+ }
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.status == 200
+} -run
+
+varnish v1 -badvcl {
+ backend 0fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
+ {
+ .host = "127.0.0.1";
+ .port = "54321";
+ }
+ sub vcl_recv {
+ if (req.url == "never") {
+ set req.backend = fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210;
+ }
+ }
+}
diff --git a/lib/libvcl/vcc_backend.c b/lib/libvcl/vcc_backend.c
index f79447f..836d4c0 100644
--- a/lib/libvcl/vcc_backend.c
+++ b/lib/libvcl/vcc_backend.c
@@ -713,6 +713,13 @@ vcc_ParseDirector(struct vcc *tl)
vcc_ExpectCid(tl); /* ID: name */
ERRCHK(tl);
+ if (tl->t->e - tl->t->b > 64) {
+ VSB_printf(tl->sb,
+ "Name of %.*s too long (max 64, is %zd):\n",
+ PF(t_first), (tl->t->e - tl->t->b));
+ vcc_ErrWhere(tl, tl->t);
+ return;
+ }
tl->t_dir = tl->t;
vcc_NextToken(tl);
More information about the varnish-commit
mailing list