From a50bbff2f4f41abb752b6f75ea3c3b77886611ce Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Tue, 16 Dec 2014 11:26:04 -0800
Subject: [PATCH 283/305] Ticket 47965 - Fix coverity issues (2014/12/16)
12867 - Uninitialized pointer read
Description:
The third arg for ldap_utf8strtok_r is supposed to be initialized.
https://fedorahosted.org/389/ticket/47965
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
(cherry picked from commit 62072539953d0956e0f2664ef1a3691cf8fbdac0)
(cherry picked from commit a2977b4b1839f4853594a46593ac5e2e27155bed)
(cherry picked from commit 9793fc437a75cca804be7cbec1def59c156f79c1)
Conflicts:
ldap/servers/plugins/acl/aclparse.c
ldap/servers/plugins/replication/windows_connection.c
ldap/servers/plugins/replication/windows_private.c
(cherry picked from commit 3d69f154192244de2b08b26ea09981cd3f02eecb)
---
ldap/servers/plugins/acl/acllas.c | 6 +++---
ldap/servers/plugins/acl/aclparse.c | 3 ++-
ldap/servers/plugins/replication/repl5_replica.c | 2 +-
ldap/servers/plugins/replication/repl_extop.c | 4 ++--
ldap/servers/plugins/rootdn_access/rootdn_access.c | 2 +-
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 2 +-
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index 3fb5d79..fc7f185 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -1212,7 +1212,7 @@ DS_LASUserDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
/* See if we have a parent[2].attr" rule */
if (strstr(attrName, "parent[") != NULL) {
- char *word, *str, *next;
+ char *word, *str, *next = NULL;
numOflevels = 0;
n_currEntryDn = slapi_entry_get_ndn ( lasinfo.resourceEntry );
@@ -1458,7 +1458,7 @@ DS_LASLdapUrlAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
/* See if we have a parent[2].attr" rule */
if (strstr(attrName, "parent[") != NULL) {
- char *word, *str, *next;
+ char *word, *str, *next = NULL;
numOflevels = 0;
n_currEntryDn = slapi_entry_get_ndn ( lasinfo.resourceEntry );
@@ -2626,7 +2626,7 @@ DS_LASGroupDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
/* See if we have a parent[2].attr" rule */
if (strstr(attrName, "parent[") != NULL) {
- char *word, *str, *next;
+ char *word, *str, *next = NULL;
numOflevels = 0;
n_currEntryDn = slapi_entry_get_ndn ( lasinfo.resourceEntry ) ;
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index 26d57c4..098b5f7 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -484,6 +484,7 @@ __aclp__sanity_check_acltxt (aci_t *aci_item, char *str)
}
newstr = slapi_ch_strdup (str);
+ next = NULL;
word = ldap_utf8strtok_r(newstr, " ", &next);
if (strcasecmp (word, "version") == 0) {
word = ldap_utf8strtok_r(NULL, " ", &next);
@@ -1189,7 +1190,7 @@ __aclp__get_aci_right (char *str)
{
char *sav_str = slapi_ch_strdup(str);
- char *t, *tt;
+ char *t, *tt = NULL;
int type = 0;
char *delimiter = ",";
char *val = NULL;
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 3cc5cbb..f64e719 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -1837,7 +1837,7 @@ replica_check_for_tasks(Replica *r, Slapi_Entry *e)
char *forcing;
char *csnpart;
char *ridstr;
- char *iter;
+ char *iter = NULL;
int i;
for(i = 0; i < CLEANRIDSIZ && clean_vals[i]; i++){
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 92207df..15e9758 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -1461,7 +1461,7 @@ multimaster_extop_abort_cleanruv(Slapi_PBlock *pb)
char *repl_root;
char *payload = NULL;
char *certify_all;
- char *iter;
+ char *iter = NULL;
int rc = LDAP_SUCCESS;
slapi_pblock_get(pb, SLAPI_EXT_OP_REQ_OID, &extop_oid);
@@ -1589,7 +1589,7 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb)
char *force = NULL;
char *extop_oid;
char *repl_root;
- char *iter;
+ char *iter = NULL;
int release_it = 0;
int rid = 0;
int rc = LDAP_OPERATIONS_ERROR;
diff --git a/ldap/servers/plugins/rootdn_access/rootdn_access.c b/ldap/servers/plugins/rootdn_access/rootdn_access.c
index ad1e125..b2596c1 100644
--- a/ldap/servers/plugins/rootdn_access/rootdn_access.c
+++ b/ldap/servers/plugins/rootdn_access/rootdn_access.c
@@ -219,7 +219,7 @@ rootdn_load_config(Slapi_PBlock *pb)
Slapi_Entry *e = NULL;
char *openTime = NULL;
char *closeTime = NULL;
- char *token, *iter, *copy;
+ char *token, *iter = NULL, *copy;
char hour[3], min[3];
int result = 0;
int time;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 16ffa42..1992174 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -509,7 +509,7 @@ attr_index_parse_idlistsize(struct attrinfo *ai, const char *strval, struct inde
int rc = 0; /* assume success */
char *mystr = slapi_ch_strdup(strval); /* copy for strtok */
char *values = NULL;
- char *lasts, *val, *ptr;
+ char *lasts = NULL, *val, *ptr;
int seen_limit = 0, seen_type = 0, seen_flags = 0, seen_values = 0;
Slapi_Attr *attr = &ai->ai_sattr;
--
1.9.3