]> 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, 17 Sep 2021 09:03:48 +0000 (11:03 +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.

src/util-lua-common.c

index 7520d6148b0f75ffd3a8a5ec626ecc2e14489c13..833e47b71444904fb71d755982c67271ffe3afc2 100644 (file)
@@ -750,7 +750,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)
 {
@@ -803,7 +804,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