summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-09 20:50:55 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-20 11:53:56 -0700
commitc27be88f0f5be0646373542d729e6384731def98 (patch)
tree814abddcfbe5ac0f2985d9be500debc43cc4338f /ldap
parenta084c9510563b36a0fb32f627efae271696dbe66 (diff)
downloadds-c27be88f0f5be0646373542d729e6384731def98.tar.gz
ds-c27be88f0f5be0646373542d729e6384731def98.tar.xz
ds-c27be88f0f5be0646373542d729e6384731def98.zip
Bug 613056 - fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939
https://bugzilla.redhat.com/show_bug.cgi?id=613056 Resolves: bug 613056 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939 description: Catch possible NULL pointer in slapi_entry_syntax_check() and slapi_mods_syntax_check().
Diffstat (limited to 'ldap')
-rw-r--r--ldap/servers/slapd/plugin_syntax.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/ldap/servers/slapd/plugin_syntax.c b/ldap/servers/slapd/plugin_syntax.c
index 174b136f..163e8d46 100644
--- a/ldap/servers/slapd/plugin_syntax.c
+++ b/ldap/servers/slapd/plugin_syntax.c
@@ -368,10 +368,14 @@ slapi_entry_syntax_check(
char *errp = &errtext[0];
size_t err_remaining = sizeof(errtext);
- if (pb != NULL) {
- slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
+ if (!pb) {
+ LDAPDebug( LDAP_DEBUG_ANY, "slapi_entry_syntax_check: NULL PBlock\n", 0, 0, 0 );
+ ret = 1;
+ goto exit;
}
+ slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
+
/* If syntax checking and logging are off, or if this is a
* replicated operation, just return that the syntax is OK. */
if (((syntaxcheck == 0) && (syntaxlogging == 0) && (override == 0)) ||
@@ -404,12 +408,10 @@ slapi_entry_syntax_check(
}
if (syntaxcheck || override) {
- if (pb) {
- /* Append new text to any existing text. */
- errp += PR_snprintf( errp, err_remaining,
- "%s: value #%d invalid per syntax\n", a->a_type, hint );
- err_remaining -= errp - &errtext[0];
- }
+ /* Append new text to any existing text. */
+ errp += PR_snprintf( errp, err_remaining,
+ "%s: value #%d invalid per syntax\n", a->a_type, hint );
+ err_remaining -= errp - &errtext[0];
ret = 1;
}
}
@@ -456,15 +458,13 @@ slapi_mods_syntax_check(
char *dn = NULL;
LDAPMod *mod = NULL;
- if (mods == NULL) {
+ if (pb == NULL || mods == NULL) {
ret = 1;
goto exit;
}
- if (pb != NULL) {
- slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
- slapi_pblock_get(pb, SLAPI_TARGET_DN, &dn);
- }
+ slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
+ slapi_pblock_get(pb, SLAPI_TARGET_DN, &dn);
/* If syntax checking and logging are off, or if this is a
* replicated operation, just return that the syntax is OK. */
@@ -496,12 +496,10 @@ slapi_mods_syntax_check(
}
if (syntaxcheck || override) {
- if (pb) {
- /* Append new text to any existing text. */
- errp += PR_snprintf( errp, err_remaining,
- "%s: value #%d invalid per syntax\n", mod->mod_type, j );
- err_remaining -= errp - &errtext[0];
- }
+ /* Append new text to any existing text. */
+ errp += PR_snprintf( errp, err_remaining,
+ "%s: value #%d invalid per syntax\n", mod->mod_type, j );
+ err_remaining -= errp - &errtext[0];
ret = 1;
}
}