dovecot-1.2-sieve: lib-sieve: Fixed code block read bounds check...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Sep 15 18:52:05 EEST 2013


details:   http://hg.rename-it.nl/dovecot-1.2-sieve/rev/885bb670a0f5
changeset: 1293:885bb670a0f5
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Sep 15 17:51:59 2013 +0200
description:
lib-sieve: Fixed code block read bounds checking.

diffstat:

 src/lib-sieve/sieve-binary.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 494d51a4b07b -r 885bb670a0f5 src/lib-sieve/sieve-binary.c
--- a/src/lib-sieve/sieve-binary.c	Sun Sep 15 12:19:10 2013 +0200
+++ b/src/lib-sieve/sieve-binary.c	Sun Sep 15 17:51:59 2013 +0200
@@ -1637,7 +1637,7 @@
 #define ADDR_POINTER(binary, address) \
 	((uint8_t *) (&(binary)->code[*address]))
 #define ADDR_BYTES_LEFT(binary, address) \
-	((binary)->code_size - (*address))
+	((*address) > (binary)->code_size ? 0 : ((binary)->code_size - (*address)))
 #define ADDR_JUMP(address, offset) \
 	(*address) += offset
 
@@ -1761,7 +1761,7 @@
 	unsigned int offset = *offset_r;
 	const struct sieve_extension *ext = NULL;
 
-	if ( ADDR_BYTES_LEFT(sbin, address) <= 0 )
+	if ( ADDR_BYTES_LEFT(sbin, address) == 0 )
 		return FALSE;
 
 	(*offset_r) = code = ADDR_DATA_AT(sbin, address);
@@ -1791,7 +1791,7 @@
 	if ( objs->count == 1 )
 		return objs->objects;
 
-	if ( ADDR_BYTES_LEFT(sbin, address) <= 0 )
+	if ( ADDR_BYTES_LEFT(sbin, address) == 0 )
 		return NULL;
 
 	code = ADDR_DATA_AT(sbin, address);


More information about the dovecot-cvs mailing list