summaryrefslogtreecommitdiff
path: root/src/imlib.c
diff options
context:
space:
mode:
authorDavid Buchanan <d@vidbuchanan.co.uk>2021-06-21 17:24:50 +0100
committerDavid Buchanan <d@vidbuchanan.co.uk>2021-06-21 17:24:50 +0100
commit0e4592a5e39261ef02c8502f92703b128ad59ffc (patch)
treed243a0815fdef1e8b10129c9eca75edaa841d507 /src/imlib.c
parent79f2dffe1b5f5c6656285ce0bc65b5e4c5c9bb10 (diff)
Fix feh_is_image for tiny files
Diffstat (limited to 'src/imlib.c')
-rw-r--r--src/imlib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/imlib.c b/src/imlib.c
index 3a7cb6d..6f31e96 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -253,7 +253,9 @@ int feh_is_image(feh_file * file)
if (!fh) {
return 0;
}
- if (fread(buf, 1, 16, fh) != 16) {
+ // Files smaller than buf will be padded with zeroes
+ memset(buf, 0, sizeof(buf));
+ if (fread(buf, 1, 16, fh) <= 0) {
fclose(fh);
return 0;
}