From: Pierangelo Masarati Date: Sat, 22 Nov 2003 16:06:38 +0000 (+0000) Subject: fix tricky signed/unsigned comparison (ITS#2835) X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~414 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=88e8caf3e1c9d3f2b514f085c382ea137aab483d;p=openldap fix tricky signed/unsigned comparison (ITS#2835) --- 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; }