Re: [Prelude Universal SIM system] #332: Error about missing arguments in prelude-correlator lua ruleset

"Prelude Universal SIM system" <[email protected]> Fri, 06 Feb 2009 06:02:41 -0000
Newsgroups gmane.comp.security.ids.prelude.devel
Message-ID <[email protected]>
#332: Error about missing arguments in prelude-correlator lua ruleset
------------------------------------------+---------------------------------
 Reporter:  jerome.benoit@…               |        Type:  defect            
   Status:  new                           |    Priority:  normal            
Milestone:  Prelude-Correlator 0.9.0      |   Component:  prelude-correlator
  Version:  0.9                           |    Severity:  normal            
 Keywords:                                |  
------------------------------------------+---------------------------------

Comment(by jeff@…):

 After looking at the source code it seems to me that the problem is
 actually in IDMEF_getraw.  There are circumstances where IDMEF_getraw can
 return zero values on the stack, thereby causing what looks like:

  ca:set("alert.source", INPUT:getraw("alert.source"))

 to execute like it's:

  ca:set("alert.source")

 I haven't tested it yet, but changing IDMEF_getraw so that it returns a
 Lua nil value if idmef_path_get returns zero values should fix things up:

 {{{
 diff --git a/plugins/lua/lua-idmef.c b/plugins/lua/lua-idmef.c
 index ebde74a..09e82c9 100644
 --- a/plugins/lua/lua-idmef.c
 +++ b/plugins/lua/lua-idmef.c
 @@ -320,8 +320,10 @@ static int IDMEF_getraw(lua_State *lstate)
                  return -1;
          }

 -        if ( ret == 0 )
 -                return 0;
 +        if ( ret == 0 ) {
 +                lua_pushnil(lstate);
 +                return 1;
 +        }

          pushIDMEFValue(lstate, value);
          return 1;
 }}}

-- 
Ticket URL: <https://trac.prelude-ids.org/ticket/332#comment:8>
Prelude Universal SIM system <http://www.prelude-ids.com>
Prelude Universal SIM system
_______________________________________________
Prelude-devel site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-devel