From 88e8caf3e1c9d3f2b514f085c382ea137aab483d Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 22 Nov 2003 16:06:38 +0000 Subject: [PATCH] fix tricky signed/unsigned comparison (ITS#2835) --- libraries/liblutil/passwd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 45f0ac661e..9bf78292c8 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -485,7 +485,7 @@ static int chk_ssha1( rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len); - if (rc <= sizeof(SHA1digest)) { + if (rc < 0 || (unsigned)rc <= sizeof(SHA1digest)) { ber_memfree(orig_pass); return -1; } @@ -566,7 +566,7 @@ static int chk_smd5( rc = lutil_b64_pton(passwd->bv_val, orig_pass, passwd->bv_len); - if (rc <= sizeof(MD5digest)) { + if (rc < 0 || (unsigned)rc <= sizeof(MD5digest)) { ber_memfree(orig_pass); return -1; } -- 2.39.5