Commit 07bb46de authored by Max Kellermann's avatar Max Kellermann

input_file: refuse to open non-regular files

Don't allow users to open a file which is non-regular (e.g. pipes, devices).
parent 84f7d9c6
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment