summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-01 23:46:30 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-23 11:05:17 -0700
commita3238ff1aa74aba2c3fd28c9b903db22ef9060e0 (patch)
tree5fbd93195e4d72e2377844744be366fccefd3bb2 /ldap/servers/slapd
parentf931ca2ce713f0b46a44115259a3fb2b560c48e8 (diff)
downloadds-a3238ff1aa74aba2c3fd28c9b903db22ef9060e0.tar.gz
ds-a3238ff1aa74aba2c3fd28c9b903db22ef9060e0.tar.xz
ds-a3238ff1aa74aba2c3fd28c9b903db22ef9060e0.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 ldbm_instance_config_load_dse_info() and ldbm_instance_modify_config_entry_callback().
Diffstat (limited to 'ldap/servers/slapd')
-rw-r--r--ldap/servers/slapd/back-ldbm/ldbm_instance_config.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index a33bb786..462a501f 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -512,7 +512,16 @@ ldbm_instance_config_load_dse_info(ldbm_instance *inst)
rval = 1;
goto bail;
}
+
search_pb = slapi_pblock_new();
+ if (!search_pb) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "ldbm_instance_config_load_dse_info: Out of memory\n",
+ 0, 0, 0);
+ rval = 1;
+ goto bail;
+ }
+
slapi_search_internal_set_pb(search_pb, dn, LDAP_SCOPE_BASE,
"objectclass=*", NULL, 0, NULL, NULL,
li->li_identity, 0);
@@ -741,7 +750,16 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
PR_Lock(inst->inst_config_mutex);
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
-
+
+ if (!returntext) {
+ rc = LDAP_OPERATIONS_ERROR;
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "ldbm_instance_modify_config_entry_callback: "
+ "NULL return text\n",
+ 0, 0, 0);
+ goto out;
+ }
+
returntext[0] = '\0';
/*
@@ -755,10 +773,8 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
if (strcasecmp(attr_name, CONFIG_INSTANCE_SUFFIX) == 0) {
/* naughty naughty, we don't allow this */
rc = LDAP_UNWILLING_TO_PERFORM;
- if (returntext) {
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
- "Can't change the root suffix of a backend");
- }
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ "Can't change the root suffix of a backend");
LDAPDebug(LDAP_DEBUG_ANY,
"ldbm: modify attempted to change the root suffix "
"of a backend (which is not allowed)\n",
@@ -787,6 +803,7 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
}
}
+out:
PR_Unlock(inst->inst_config_mutex);
*returncode = rc;