prelude-correlator/master: Fix rare IDMEF:Set() exception

[email protected] Thu, 9 Jul 2009 17:57:27 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 73a0f921c59db07a1edc2a7bc596e2635ba3be41
Author: Yoann Vandoorselaere <[email protected]>
Date:   Wed Jun 24 13:15:03 2009 +0200

    Fix rare IDMEF:Set() exception
    
    A rare exception would occur when IDMEF:Set() was called with
    an empty list/tuple as the value argument. This case is now
    handled specificaly for consistancy with IDMEF:Get() (which
    can return an empty tuple in case the retrieved path is empty
    and ambiguous).


========================================

 PreludeCorrelator/idmef.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

========================================

diff --git a/PreludeCorrelator/idmef.py b/PreludeCorrelator/idmef.py
index 2fe9d1f..42f87a2 100644
--- a/PreludeCorrelator/idmef.py
+++ b/PreludeCorrelator/idmef.py
@@ -67,6 +67,12 @@ class IDMEF(PreludeEasy.IDMEF):
                         if cur and value.Match(cur, PreludeEasy.IDMEFCriterion.OPERATOR_EQUAL) > 0:
                                 return
 
+                elif type(value) is tuple or type(value) is list:
+                        if value: # not empty
+                                raise Exception, "Invalid input value"
+
+                        value = None
+
                 PreludeEasy.IDMEF.Set(self, path, value)
 
         def _match(self, path, needle):
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog