From 878d97068cb6c8ae044332ac3c8218fcad635b42 Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Thu, 20 Oct 2016 10:21:55 +0200 Subject: Only open regular files; fixes issue #252 --- image.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'image.c') diff --git a/image.c b/image.c index ebd522d..801bbe5 100644 --- a/image.c +++ b/image.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -296,8 +297,10 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) bool img_load(img_t *img, const fileinfo_t *file) { const char *fmt; + struct stat st; - if (access(file->path, R_OK) < 0 || + if (access(file->path, R_OK) == -1 || + stat(file->path, &st) == -1 || !S_ISREG(st.st_mode) || (img->im = imlib_load_image(file->path)) == NULL) { if (file->flags & FF_WARN) -- cgit v1.2.3