[PATCH 1/1] fix libssl version check

Christian Hesse list at eworm.de
Thu Oct 16 12:15:44 CEST 2014


From: Christian Hesse <mail at eworm.de>

When doing bitwise AND leading zeros do not matter, trailing ones do.

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 src/main/version.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/version.c b/src/main/version.c
index 8b56ffa..9d317e2 100644
--- a/src/main/version.c
+++ b/src/main/version.c
@@ -56,7 +56,7 @@ int ssl_check_consistency(void)
 	/*
 	 *	Status mismatch always triggers error.
 	 */
-	if ((ssl_linked & 0x00000000f) != (ssl_built & 0x00000000f)) {
+	if ((ssl_linked & 0x0000000f) != (ssl_built & 0x0000000f)) {
 	mismatch:
 		ERROR("libssl version mismatch.  built: %lx linked: %lx",
 		       (unsigned long) ssl_built,
@@ -70,14 +70,14 @@ int ssl_check_consistency(void)
 	 *	1.0.0 and only allow moving backwards within a patch
 	 *	series.
 	 */
-	if (ssl_built & 0xff) {
-		if ((ssl_built & 0xffff) != (ssl_linked & 0xffff) ||
-		    (ssl_built & 0x0000ff) > (ssl_linked & 0x0000ff)) goto mismatch;
+	if (ssl_built & 0xf0000000 >= 0x10000000) {
+		if ((ssl_built & 0xfffff000) != (ssl_linked & 0xfffff000) ||
+		    (ssl_built & 0x00000ff0) > (ssl_linked & 0x00000ff0)) goto mismatch;
 	/*
 	 *	Before 1.0.0 we require the same major minor and fix version
 	 *	and ignore the patch number.
 	 */
-	} else if ((ssl_built & 0xffffff) != (ssl_linked & 0xffffff)) goto mismatch;
+	} else if ((ssl_built & 0xfffff000) != (ssl_linked & 0xfffff000)) goto mismatch;
 
 	return 0;
 }
-- 
2.1.2



More information about the Freeradius-Devel mailing list