r2379 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Wed Jan 23 17:23:29 CET 2008


Author: des
Date: 2008-01-23 17:23:28 +0100 (Wed, 23 Jan 2008)
New Revision: 2379

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_vcc.c
Log:
It is possible for VSS_parse() to succeed and return a NULL addr but a
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)


Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2008-01-23 16:11:31 UTC (rev 2378)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c	2008-01-23 16:23:28 UTC (rev 2379)
@@ -412,6 +412,14 @@
 		 * 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);
 		}




More information about the varnish-commit mailing list