dovecot-2.2-pigeonhole: lib-sieve: relational extension: Fixed e...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Tue Jun 17 21:19:48 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/1c7a4ec3fd80
changeset: 1876:1c7a4ec3fd80
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Tue Jun 17 23:19:37 2014 +0200
description:
lib-sieve: relational extension: Fixed error handling of :value match.
Switch statement item is never reached and return value was bool instead of int.
Problem reported by Coverity.

diffstat:

 src/lib-sieve/plugins/relational/mcht-value.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (34 lines):

diff -r 14ca1297d52d -r 1c7a4ec3fd80 src/lib-sieve/plugins/relational/mcht-value.c
--- a/src/lib-sieve/plugins/relational/mcht-value.c	Tue Jun 17 23:04:24 2014 +0200
+++ b/src/lib-sieve/plugins/relational/mcht-value.c	Tue Jun 17 23:19:37 2014 +0200
@@ -63,23 +63,22 @@
 
 	switch ( rel_match ) {
 	case REL_MATCH_GREATER:
-		return ( cmp_result > 0 );
+		return ( cmp_result > 0 ? 1 : 0 );
 	case REL_MATCH_GREATER_EQUAL:
-		return ( cmp_result >= 0 );
+		return ( cmp_result >= 0 ? 1 : 0 );
 	case REL_MATCH_LESS:
-		return ( cmp_result < 0 );
+		return ( cmp_result < 0 ? 1 : 0 );
 	case REL_MATCH_LESS_EQUAL:
-		return ( cmp_result <= 0 );
+		return ( cmp_result <= 0 ? 1 : 0 );
 	case REL_MATCH_EQUAL:
-		return ( cmp_result == 0 );
+		return ( cmp_result == 0 ? 1 : 0);
 	case REL_MATCH_NOT_EQUAL:
-		return ( cmp_result != 0 );
-	case REL_MATCH_INVALID:
+		return ( cmp_result != 0 ? 1 : 0);
  	default:
 		break;
 	}
 
-	return FALSE;
+	return -1;
 }
 
 


More information about the dovecot-cvs mailing list