From a426af8058bc7982a0004e78ee833f61f5633a33 Mon Sep 17 00:00:00 2001
From: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Fri, 23 Jul 2021 18:36:22 +0200
Subject: [PATCH] Fix out of boundary access on illegal argument

Calling feh with an empty argument leads to out of boundary access.
This can be seen best when compiled with asan:

$ feh ""
---
 src/filelist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/filelist.c b/src/filelist.c
index 49355c4..e70e003 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -202,7 +202,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
 	struct stat st;
 	char *path;
 
-	if (!origpath)
+	if (!origpath || *origpath == '\0')
 		return;
 
 	path = estrdup(origpath);
-- 
GitLab