]> err.no Git - varnish/commitdiff
It is possible for VSS_parse() to succeed and return a NULL addr but a
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Jan 2008 16:23:28 +0000 (16:23 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Jan 2008 16:23:28 +0000 (16:23 +0000)
non-NULL port (e.g. ":80" which is a valid listening address).  In that
case, port should be free()d before returning.

Coverity Scan (CID:15)

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2379 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/mgt_vcc.c

index c34ede50cc9e6acc8a6d39c56f89ef3c25f4af98..92a7ffc07ac10a51f833abf0667eb2f6f880a058 100644 (file)
@@ -412,6 +412,14 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, int f_fd, int C_flag)
                 * XXX: again: we should check it here in the "trivial" case.
                 */
                if (VSS_parse(b_arg, &addr, &port) != 0 || addr == NULL) {
+                       /*
+                        * (addr == NULL && port != NULL) is possible if
+                        * the user incorrectly specified an address such
+                        * as ":80", which is a valid listening address.
+                        * In the future, we may want to interpret this as
+                        * a shortcut for "localhost:80".
+                        */
+                       free(port);
                        fprintf(stderr, "invalid backend address\n");
                        return (1);
                }