summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/schema.c
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-02 00:18:18 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-23 11:05:55 -0700
commitca2f99b78387c0e5f5f91c7c1951958cdf3b6c09 (patch)
tree68e67653e8b92962f4f077d6ee755e08ef0d339c /ldap/servers/slapd/schema.c
parent2237cbb7f9bdadfee9913f32a71eccd73d57d27b (diff)
downloadds-ca2f99b78387c0e5f5f91c7c1951958cdf3b6c09.tar.gz
ds-ca2f99b78387c0e5f5f91c7c1951958cdf3b6c09.tar.xz
ds-ca2f99b78387c0e5f5f91c7c1951958cdf3b6c09.zip
Bug 610119 - fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199
https://bugzilla.redhat.com/show_bug.cgi?id=610119 Resolves: bug 610119 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199 Fix description: Catch possible NULL pointer in slapi_entry_schema_check().
Diffstat (limited to 'ldap/servers/slapd/schema.c')
-rw-r--r--ldap/servers/slapd/schema.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 45394427..6e2fefe7 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -508,6 +508,20 @@ slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e )
ocname = slapi_value_get_string(v);
+ if ( !ocname ) {
+ char ebuf[ BUFSIZ ];
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "Entry \"%s\" \"objectclass\" value missing\n",
+ escape_string( slapi_entry_get_dn_const(e), ebuf ), 0, 0 );
+ if (pb) {
+ PR_snprintf( errtext, sizeof( errtext ),
+ "missing \"objectclass\" value\n" );
+ slapi_pblock_set( pb, SLAPI_PB_RESULT_TEXT, errtext );
+ }
+ ret = 1;
+ goto out;
+ }
+
if ( isExtensibleObjectclass( ocname )) {
/*
* if the entry is an extensibleObject, just check to see if
@@ -524,7 +538,7 @@ slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e )
/* we don't know about the oc; return an appropriate error message */
char ebuf[ BUFSIZ ];
char ebuf2[ BUFSIZ ];
- size_t ocname_len = ( ocname == NULL ) ? 0 : strlen( ocname );
+ size_t ocname_len = strlen( ocname );
const char *extra_msg = "";
if ( ocname_len > 0 && isspace( ocname[ ocname_len-1 ] )) {