From: Juliana Fajardini Date: Tue, 14 Sep 2021 08:49:07 +0000 (+0100) Subject: util/lua-common: fix SCFileInfo bug & doc comment X-Git-Tag: suricata-5.0.8~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ced0937e71ceb3b1d7fe5a297f2916c9228623d3;p=thirdparty%2Fsuricata.git util/lua-common: fix SCFileInfo bug & doc comment The callback for FileInfo was returning the wrong value, resulting in loss of some tuple values for one calling SCFileInfo in a script. The documentation comment wasn't mentioning the sha items that are pushed. (cherry picked from commit 1315cb793b884140b51e9934ebbdc7493be22db5) --- diff --git a/src/util-lua-common.c b/src/util-lua-common.c index c45c9b1355..f987830094 100644 --- a/src/util-lua-common.c +++ b/src/util-lua-common.c @@ -711,7 +711,8 @@ static int LuaCallbackLogError(lua_State *luastate) * \retval cnt number of data items placed on the stack * * Places: fileid (number), txid (number), name (string), - * size (number), magic (string), md5 in hex (string) + * size (number), magic (string), md5 in hex (string), + * sha1 (string), sha256 (string) */ static int LuaCallbackFileInfoPushToStackFromFile(lua_State *luastate, const File *file) { @@ -766,7 +767,7 @@ static int LuaCallbackFileInfoPushToStackFromFile(lua_State *luastate, const Fil lua_pushstring(luastate, md5ptr); lua_pushstring(luastate, sha1ptr); lua_pushstring(luastate, sha256ptr); - return 6; + return 8; } /** \internal