]> git.sur5r.net Git - openldap/commitdiff
fix tricky signed/unsigned comparison (ITS#2835)
authorPierangelo Masarati <ando@openldap.org>
Sat, 22 Nov 2003 16:06:38 +0000 (16:06 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 22 Nov 2003 16:06:38 +0000 (16:06 +0000)
libraries/liblutil/passwd.c

index 45f0ac661e1055a58420484c9621813179f1181a..9bf78292c86acab093804905a51b7e1b0a43dd31 100644 (file)
@@ -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;
        }