diff --git a/src/imlib.c b/src/imlib.c
index 3a7cb6db3f26877777e4ea207a52a2d2d2f16406..6f31e96f4e826417a4bf8649c71550b2eab4264e 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;
 	}
diff --git a/test/feh.t b/test/feh.t
index 44f705f412f7f32bec3b2becdc8256e2363b8dc0..157125d97e73c1bbc3345c02921f96fb8f900114 100644
--- a/test/feh.t
+++ b/test/feh.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.010;
-use Test::Command tests => 71;
+use Test::Command tests => 73;
 
 $ENV{HOME} = 'test';
 
@@ -186,3 +186,7 @@ $cmd
 $cmd->exit_is_num(0);
 $cmd->stdout_is_file("test/${list_dir}/default");
 $cmd->stderr_is_eq('');
+
+$cmd = Test::Command->new( cmd => "$feh --list test/tiny.pbm" );
+$cmd->exit_is_num(0);
+$cmd->stderr_is_eq('');
diff --git a/test/tiny.pbm b/test/tiny.pbm
new file mode 100644
index 0000000000000000000000000000000000000000..3fb3e4e2d0e3fd517e49228b2dfaae05b5ead4ab
--- /dev/null
+++ b/test/tiny.pbm
@@ -0,0 +1,4 @@
+P4
+1 1
+
+