libprelude/master: Oops: fix invalid prelude_return_val_if_fail() usage

[email protected] Sat, 16 Jan 2010 19:58:34 +0100 (CET)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 49fa1982d8c79e520ce63ab774c05d86672be52a
Author: Yoann Vandoorselaere <[email protected]>
Date:   Tue Jan 12 05:44:30 2010 +0100

    Oops: fix invalid prelude_return_val_if_fail() usage
    
    I wasn't on drug yesterday, I swear ;).
    Fix 8af3e5fd98cd2b92146b1f433344d44e8ce9372e regression.


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

 src/idmef-path.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

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

diff --git a/src/idmef-path.c b/src/idmef-path.c
index c7e54cd..a63d702 100644
--- a/src/idmef-path.c
+++ b/src/idmef-path.c
@@ -855,7 +855,7 @@ int idmef_path_set_index(idmef_path_t *path, unsigned int depth, unsigned int in
         int ret;
 
         prelude_return_val_if_fail(path, prelude_error(PRELUDE_ERROR_ASSERTION));
-        prelude_return_val_if_fail(depth >= path->depth, prelude_error(PRELUDE_ERROR_IDMEF_PATH_DEPTH));
+        prelude_return_val_if_fail(depth < path->depth, prelude_error(PRELUDE_ERROR_IDMEF_PATH_DEPTH));
 
         if ( index == INDEX_FORBIDDEN )
                 return prelude_error(PRELUDE_ERROR_IDMEF_PATH_INDEX_RESERVED);
@@ -912,7 +912,7 @@ int idmef_path_undefine_index(idmef_path_t *path, unsigned int depth)
 int idmef_path_get_index(const idmef_path_t *path, unsigned int depth)
 {
         prelude_return_val_if_fail(path, prelude_error(PRELUDE_ERROR_ASSERTION));
-        prelude_return_val_if_fail(depth >= path->depth, prelude_error(PRELUDE_ERROR_IDMEF_PATH_DEPTH));
+        prelude_return_val_if_fail(depth < path->depth, prelude_error(PRELUDE_ERROR_IDMEF_PATH_DEPTH));
 
         if ( path->elem[depth].index == INDEX_UNDEFINED )
                 return prelude_error(PRELUDE_ERROR_IDMEF_PATH_INDEX_UNDEFINED);
@@ -1280,7 +1280,7 @@ const char *idmef_path_get_name(const idmef_path_t *path, int depth)
         const idmef_path_element_t *elem;
 
         prelude_return_val_if_fail(path, NULL);
-        prelude_return_val_if_fail(depth < 0 || depth <= path->depth, NULL);
+        prelude_return_val_if_fail(depth < 0 || depth < path->depth, NULL);
 
         if ( depth < 0 )
                 return path->name;
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog