]> err.no Git - varnish/commitdiff
Make sure the VCL we try to load is a regular file
authortfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 10 Nov 2008 11:55:17 +0000 (11:55 +0000)
committertfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 10 Nov 2008 11:55:17 +0000 (11:55 +0000)
Fixes #368

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

varnish-cache/lib/libvcl/vcc_compile.c

index 34acee4a4d1a39e52404e60023d7974203a82d40..0db0c569673c63cd3765883ba940bba97392b142 100644 (file)
@@ -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);