]> git.sur5r.net Git - openldap/commitdiff
ITS#5100 ldap_control_dup - OID must be non-NULL
authorQuanah Gibson-Mount <quanah@openldap.org>
Wed, 17 Oct 2007 04:03:56 +0000 (04:03 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 17 Oct 2007 04:03:56 +0000 (04:03 +0000)
libraries/libldap/controls.c

index 059dc5266f268d434d1369dda5f3fcbec5a05a71..48c29a5473ca05dfeba4e29dd65720bff6e80a8c 100644 (file)
@@ -337,7 +337,7 @@ ldap_control_dup( const LDAPControl *c )
 {
        LDAPControl *new;
 
-       if ( c == NULL ) {
+       if ( c == NULL || c->ldctl_oid == NULL ) {
                return NULL;
        }
 
@@ -347,17 +347,11 @@ ldap_control_dup( const LDAPControl *c )
                return NULL;
        }
 
-       if( c->ldctl_oid != NULL ) {
-               new->ldctl_oid = LDAP_STRDUP( c->ldctl_oid );
+       new->ldctl_oid = LDAP_STRDUP( c->ldctl_oid );
 
-               if(new->ldctl_oid == NULL) {
-                       LDAP_FREE( new );
-                       return NULL;
-               }
-
-       } else {
-               /* FIXME: how can a control have null OID? */
-               new->ldctl_oid = NULL;
+       if(new->ldctl_oid == NULL) {
+               LDAP_FREE( new );
+               return NULL;
        }
 
        if( c->ldctl_value.bv_val != NULL ) {