]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util/lua-common: fix SCFileInfo bug & doc comment
authorJuliana Fajardini <jufajardini@gmail.com>
Tue, 14 Sep 2021 08:49:07 +0000 (09:49 +0100)
committerShivani Bhardwaj <shivanib134@gmail.com>
Wed, 22 Sep 2021 12:01:21 +0000 (17:31 +0530)
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)

src/util-lua-common.c

index 4d6aa26e75783fa26304ec5c72d3010d70144cd2..5812106eb6fa34c8351fd347ecb679851f74c91e 100644 (file)
@@ -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