input_file: refuse to open non-regular files
Don't allow users to open a file which is non-regular (e.g. pipes, devices).
This commit is contained in:
parent
84f7d9c6b3
commit
07bb46de88
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user