From: Kurt Zeilenga Date: Tue, 18 Aug 1998 02:25:43 +0000 (+0000) Subject: Added patch from Stuar Lynn to ensure oc_required is not null before loop. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd5226bfee1e849c135335d00067f60637a80ea6;p=thirdparty%2Fopenldap.git Added patch from Stuar Lynn to ensure oc_required is not null before loop. --- diff --git a/servers/slapd/schema.c b/servers/slapd/schema.c index ba16d9b0f1..816521d56f 100644 --- a/servers/slapd/schema.c +++ b/servers/slapd/schema.c @@ -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 )