From 07bb46de88a6af3547d40452771e687a45592404 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Oct 2008 21:11:28 +0100 Subject: input_file: refuse to open non-regular files Don't allow users to open a file which is non-regular (e.g. pipes, devices). --- src/input_file.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/input_file.c b/src/input_file.c index 8ed9c3d75..7806e15ab 100644 --- a/src/input_file.c +++ b/src/input_file.c @@ -50,6 +50,13 @@ input_file_open(struct input_stream *is, const char *filename) return false; } + if (!S_ISREG(st.st_mode)) { + g_debug("Not a regular file: %s\n", filename); + is->error = EINVAL; + close(fd); + return false; + } + is->size = st.st_size; #ifdef POSIX_FADV_SEQUENTIAL -- cgit v1.2.3