diff --git a/shared/config-parser.c b/shared/config-parser.c index 4542ca61..ff6814ce 100644 --- a/shared/config-parser.c +++ b/shared/config-parser.c @@ -326,6 +326,7 @@ weston_config_parse(const char *name) { FILE *fp; char line[512], *p; + struct stat filestat; struct weston_config *config; struct weston_config_section *section = NULL; int i, fd; @@ -342,6 +343,13 @@ weston_config_parse(const char *name) return NULL; } + if (fstat(fd, &filestat) < 0 || + !S_ISREG(filestat.st_mode)) { + close(fd); + free(config); + return NULL; + } + fp = fdopen(fd, "r"); if (fp == NULL) { free(config);