Actions
Bug #9084
closed
VJ
VJ
lua: enable_hassh()/enable_ja3() return 1 without pushing a value
Bug #9084:
lua: enable_hassh()/enable_ja3() return 1 without pushing a value
Affected Versions:
Effort:
Difficulty:
Label:
Description
- Status: present in
main(9b7938aec); code-confirmed - Class: C-function stack-contract bug (wrong return value)
- Component:
src/util-lua-ssh.c:178-182(enable_hassh),src/util-lua-ja3.c:183-186(enable_ja3)
Description¶
Both functions end with return 1 without pushing a value:
Lua takes the result from L->top - 1, so the script receives the last argument or, when called with no arguments, the function object itself. Under LUA_USE_APICHECK the return-count check (api_checknelems) aborts.
Trigger: local r = ssh.enable_hassh() / assert(ssh.enable_hassh()) / the same for ja3.enable_ja3() from any state (rule, transform, output).
Fix direction¶
return 0; (or push a boolean/nil and return 1). Document that both are process-global, parse-time switches that only affect flows parsed afterwards.
Test¶
lua-ssh-enable-hassh-return / lua-ja3-enable-return: assert the return value is nil, from init and from an output setup.
JI Updated by Jason Ish about 1 month ago
- Status changed from New to In Review
MR1382
JI Updated by Jason Ish about 1 month ago
- Assignee set to Victor Julien
Actions