]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Added patch from Stuar Lynn to ensure oc_required is not null before loop.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 18 Aug 1998 02:25:43 +0000 (02:25 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 18 Aug 1998 02:25:43 +0000 (02:25 +0000)
servers/slapd/schema.c

index ba16d9b0f13540041d9b221fcc4db4888f99a794..816521d56f85f57fb35f3cf69a7528288fa01a93 100644 (file)
@@ -76,6 +76,11 @@ oc_check_required( Entry *e, char *ocname )
                return( 0 );
        }
 
+       /* check for empty oc_required */
+       if(oc->oc_required == NULL) {
+               return( 0 );
+       }
+
        /* for each required attribute */
        for ( i = 0; oc->oc_required[i] != NULL; i++ ) {
                /* see if it's in the entry */
@@ -111,14 +116,16 @@ oc_check_allowed( char *type, struct berval **ocl )
                /* if we know about the oc */
                if ( (oc = oc_find( ocl[i]->bv_val )) != NULL ) {
                        /* does it require the type? */
-                       for ( j = 0; oc->oc_required[j] != NULL; j++ ) {
+                       for ( j = 0; oc->oc_required != NULL && 
+                               oc->oc_required[j] != NULL; j++ ) {
                                if ( strcasecmp( oc->oc_required[j], type )
                                    == 0 ) {
                                        return( 0 );
                                }
                        }
                        /* does it allow the type? */
-                       for ( j = 0; oc->oc_allowed[j] != NULL; j++ ) {
+                       for ( j = 0; oc->oc_allowed != NULL && 
+                               oc->oc_allowed[j] != NULL; j++ ) {
                                if ( strcasecmp( oc->oc_allowed[j], type )
                                    == 0 || strcmp( oc->oc_allowed[j], "*" )
                                    == 0 )