[3.0] 4f58e8a Ignore fd's larger than 65536 in varnishncsa

Martin Blix Grydeland martin at varnish-cache.org
Tue Jan 22 13:35:32 CET 2013

commit 4f58e8a7d8077d605198fde4e33c874737af4b53
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Jan 22 13:15:06 2013 +0100

    Ignore fd's larger than 65536 in varnishncsa
    This makes varnishncsa behave the same way as varnishlog, and prevents
    overly large memory allocations if it should see a bogus fd (shmlog
    XXX: This will not fix varnishncsa for current trunk, as that is using
    XIDs instead of FDs breaking some functionality in the tools. This
    will be handled in the API rewrite.

diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index f66bb18..dc7b4f9 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -584,6 +584,10 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
 	const char *p;
 	struct vsb *os;
+	/* XXX: Ignore fd's outside 65536 */
+	if (fd >= 65536)
+		return (reopen);
 	if (fd >= nll) {
 		struct logline **newll = ll;
 		size_t newnll = nll;

More information about the varnish-commit mailing list