diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-07-01 13:57:58 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-07-07 17:15:51 -0700 |
commit | 19bd0d6890f07f9b0d1e2041398f985ac94294a5 (patch) | |
tree | 09b0ba6898bc2adbb8d5c3f6981722ee58c10fad | |
parent | 4b2c04ee518ab078e18707871d6c7a88f00b2d5c (diff) | |
download | ds-19bd0d6890f07f9b0d1e2041398f985ac94294a5.tar.gz ds-19bd0d6890f07f9b0d1e2041398f985ac94294a5.tar.xz ds-19bd0d6890f07f9b0d1e2041398f985ac94294a5.zip |
609255 - fix coverity Defect Type: Memory - illegal accesses issues
https://bugzilla.redhat.com/show_bug.cgi?id=609255
12215 UNINIT Triaged Unassigned Bug Minor Fix Required
_cl5LDIF2Operation() ds/ldap/servers/plugins/replication/cl5_api.c
Comment:
should init rawDN to NULL and check if it is NULL before using it.
If rawDN is NULL, it returns error CL5_BAD_FORMAT.
Comment on the particular rawDN at the line 5218:
* When it comes here, case T_DNSTR is already
* passed and rawDN is supposed to set.
* But it's a good idea to make sure it is
* not NULL.
-rw-r--r-- | ldap/servers/plugins/replication/cl5_api.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index 56cc9711..f61bd0aa 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -2687,7 +2687,7 @@ cl5DBData2Entry (const char *data, PRUint32 len, CL5Entry *entry) PRUint32 thetime; slapi_operation_parameters *op; LDAPMod **add_mods; - char *rawDN; + char *rawDN = NULL; char s[CSN_STRSIZE]; PR_ASSERT (data && entry && entry->op); @@ -5010,7 +5010,7 @@ static int _cl5Operation2LDIF (const slapi_operation_parameters *op, const char char *strDeleteOldRDN; char *buff, *start; LDAPMod **add_mods; - char *rawDN; + char *rawDN = NULL; char strCSN[CSN_STRSIZE]; PR_ASSERT (op && replGen && ldifEntry && IsValidOperation (op)); @@ -5145,7 +5145,7 @@ _cl5LDIF2Operation (char *ldifEntry, slapi_operation_parameters *op, char **repl char *next, *line; char *type, *value; Slapi_Mods *mods; - char *rawDN; + char *rawDN = NULL; PR_ASSERT (op && ldifEntry && replGen); @@ -5222,7 +5222,21 @@ _cl5LDIF2Operation (char *ldifEntry, slapi_operation_parameters *op, char **repl switch (op->operation_type) { - case SLAPI_OPERATION_ADD: mods = parse_changes_string(value); + case SLAPI_OPERATION_ADD: /* + * When it comes here, case T_DNSTR is already + * passed and rawDN is supposed to set. + * But it's a good idea to make sure it is + * not NULL. + */ + if (NULL == rawDN) { + slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl, + "_cl5LDIF2Operation: corrupted format " + "for operation type - %lu\n", + op->operation_type); + return CL5_BAD_FORMAT; + } + mods = parse_changes_string(value); + PR_ASSERT (mods); slapi_mods2entry (&(op->p.p_add.target_entry), rawDN, slapi_mods_get_ldapmods_byref(mods)); slapi_ch_free ((void**)&rawDN); |