]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/compare.c
Fix ITS#1843, don't deref NULL string in ldap_pvt_str2upper
[openldap] / libraries / libldap / compare.c
index 2b890b1fe9d7af4f47646f54b9bb5f93b162121c..4af59d01b8d15842a6a5f44db0244028d1a04c66 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
@@ -36,7 +36,7 @@
  * attr and value) are supplied.  The msgid of the response is returned.
  *
  * Example:
- *     struct berval bvalue = { "secret", strlen("secret") };
+ *     struct berval bvalue = { "secret", sizeof("secret")-1 };
  *     rc = ldap_compare( ld, "c=us@cn=bob",
  *             "userPassword", &bvalue,
  *             sctrl, cctrl, &msgid )
@@ -54,7 +54,11 @@ ldap_compare_ext(
        int rc;
        BerElement      *ber;
 
+#ifdef NEW_LOGGING
+       LDAP_LOG (( "compare", LDAP_LEVEL_ENTRY, "ldap_compare\n" ));
+#else
        Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
+#endif
 
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
@@ -127,6 +131,8 @@ ldap_compare(
        int msgid;
        struct berval bvalue;
 
+       assert( value != NULL );
+
        bvalue.bv_val = (char *) value;
        bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
 
@@ -167,6 +173,8 @@ ldap_compare_s(
 {
        struct berval bvalue;
 
+       assert( value != NULL );
+
        bvalue.bv_val = (char *) value;
        bvalue.bv_len = (value == NULL) ? 0 : strlen( value );