r3378 - trunk/varnish-cache/lib/libvcl

tfheen at projects.linpro.no tfheen at projects.linpro.no
Mon Nov 10 12:55:17 CET 2008


Author: tfheen
Date: 2008-11-10 12:55:17 +0100 (Mon, 10 Nov 2008)
New Revision: 3378

Modified:
   trunk/varnish-cache/lib/libvcl/vcc_compile.c
Log:
Make sure the VCL we try to load is a regular file

Fixes #368


Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.c	2008-11-10 11:55:15 UTC (rev 3377)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.c	2008-11-10 11:55:17 UTC (rev 3378)
@@ -415,6 +415,11 @@
 		}
 	}
 	assert(0 == fstat(fd, &st));
+	if (! S_ISREG(st.st_mode)) {
+		vsb_printf(sb, "File '%s' is not a regular file\n", fn);
+		AZ(close(fd));
+		return (NULL);
+	}
 	f = malloc(st.st_size + 1);
 	assert(f != NULL);
 	i = read(fd, f, st.st_size);




More information about the varnish-commit mailing list