commit 90d148b: [Minor] Check returned value

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Oct 16 12:07:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-10-16 12:14:43 +0100
URL: https://github.com/rspamd/rspamd/commit/90d148b039be2d89a55dd3f3646dc6deb8f87208

[Minor] Check returned value

---
 src/lua/lua_util.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index 1ac69365a..fd3db0774 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -1501,7 +1501,13 @@ lua_util_glob (lua_State *L)
 		pattern = luaL_checkstring (L, i);
 
 		if (pattern) {
-			glob (pattern, flags, NULL, &gl);
+			if (glob (pattern, flags, NULL, &gl) != 0) {
+				/* There is no way to return error here, so just create an table */
+				lua_createtable (L, 0, 0);
+				globfree (&gl);
+
+				return 1;
+			}
 		}
 	}
 


More information about the Commits mailing list