From 73643a3e8778077db0bb601c453dc378ae9ad32a Mon Sep 17 00:00:00 2001 From: tfheen Date: Wed, 25 Feb 2009 10:25:43 +0000 Subject: [PATCH] Stop segfaulting when trying to set a nonexistant waiter We failed to properly check for the end of the list of waiters. Handle this correctly and add a test case Fixes #428 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3825 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_acceptor.c | 2 +- varnish-cache/bin/varnishtest/tests/b00008.vtc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 28a6a43f..1d822eaa 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -368,7 +368,7 @@ VCA_tweak_waiter(struct cli *cli, const char *arg) vca_act = NULL; return; } - for (i = 0; vca_waiters[i]->name; i++) { + for (i = 0; vca_waiters[i]; i++) { if (!strcmp(arg, vca_waiters[i]->name)) { vca_act = vca_waiters[i]; return; diff --git a/varnish-cache/bin/varnishtest/tests/b00008.vtc b/varnish-cache/bin/varnishtest/tests/b00008.vtc index baf36fbc..e883ed74 100644 --- a/varnish-cache/bin/varnishtest/tests/b00008.vtc +++ b/varnish-cache/bin/varnishtest/tests/b00008.vtc @@ -19,3 +19,7 @@ varnish v1 -start varnish v1 -cliok "help" varnish v1 -cliok "stats" + +varnish v1 -cliok "param.set waiter default" + +varnish v1 -clierr 106 "param.set waiter HASH(0x8839c4c)" -- 2.39.5