]> 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)
committerVictor Julien <victor@inliniac.net>
Fri, 24 Sep 2021 08:31:43 +0000 (10:31 +0200)
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 c45c9b1355cbbab8b50d6f1cf72c4610fce29d0e..f9878300942328e14525e35e157bfc0aff5ccb47 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