]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getentry.c
Fix ITS#1843, don't deref NULL string in ldap_pvt_str2upper
[openldap] / libraries / libldap / getentry.c
index 2cf17681d8cb2f18fe724e7c5fe601e13f1b3658..4fb23eff6cb69bc0993f0daec9c65963daf39231 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
@@ -15,7 +15,6 @@
 #include <stdio.h>
 #include <ac/stdlib.h>
 
-#include <ac/ctype.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
@@ -30,10 +29,6 @@ ldap_first_entry( LDAP *ld, LDAPMessage *chain )
        assert( LDAP_VALID( ld ) );
        assert( chain != NULL );
 
-       if( ld == NULL || chain == NULL ) {
-               return NULL;
-       }
-
        return chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY
                ? chain
                : ldap_next_entry( ld, chain );
@@ -46,11 +41,7 @@ ldap_next_entry( LDAP *ld, LDAPMessage *entry )
        assert( LDAP_VALID( ld ) );
        assert( entry != NULL );
 
-       if ( ld == NULL || entry == NULL ) {
-               return NULL;
-       }
-
-       for (
+       for(
                entry = entry->lm_chain;
                entry != NULL;
                entry = entry->lm_chain )
@@ -71,10 +62,6 @@ ldap_count_entries( LDAP *ld, LDAPMessage *chain )
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
 
-       if ( ld == NULL ) {
-               return -1;
-       }
-
        for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
                if( chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
                        i++;
@@ -98,14 +85,12 @@ ldap_get_entry_controls(
        assert( entry != NULL );
        assert( sctrls != NULL );
 
-       if ( ld == NULL || sctrls == NULL ||
-               entry == NULL || entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY )
-       {
+       if ( entry->lm_msgtype != LDAP_RES_SEARCH_ENTRY ) {
                return LDAP_PARAM_ERROR;
        }
 
        /* make a local copy of the BerElement */
-       SAFEMEMCPY(&be, entry->lm_ber, sizeof(be));
+       AC_MEMCPY(&be, entry->lm_ber, sizeof(be));
 
        if ( ber_scanf( &be, "{xx" /*}*/ ) == LBER_ERROR ) {
                rc = LDAP_DECODING_ERROR;