From: tfheen Date: Mon, 10 Nov 2008 11:55:17 +0000 (+0000) Subject: Make sure the VCL we try to load is a regular file X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=433726e9912efc79db589807deb4a8d5dc13fcde;p=varnish Make sure the VCL we try to load is a regular file Fixes #368 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3378 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvcl/vcc_compile.c b/varnish-cache/lib/libvcl/vcc_compile.c index 34acee4a..0db0c569 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.c +++ b/varnish-cache/lib/libvcl/vcc_compile.c @@ -415,6 +415,11 @@ vcc_file_source(struct vsb *sb, const char *fn, int fd) } } 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);