Browse Source

Bug 750625 - Fix Coverity (11117) Uninitialized pointer read

https://bugzilla.redhat.com/show_bug.cgi?id=750625

slapd/tools/ldclt/ldapfct.c (getPending)

Bug Description: Using uninitialized value "verb" when calling
"printf".

Fix Description: If the mode is not the supported operations,
getPending immediately return instead of going forward.
Noriko Hosoi 14 years ago
parent
commit
3ee1808340
1 changed files with 18 additions and 17 deletions
  1. 18 17
      ldap/servers/slapd/tools/ldclt/ldapfct.c

+ 18 - 17
ldap/servers/slapd/tools/ldclt/ldapfct.c

@@ -2348,24 +2348,25 @@ getPending (
     expected = LDAP_RES_ADD;
     verb     = "ldap_add";
   }
+  else if (tttctx->mode & DELETE_ENTRIES)
+  {
+    expected = LDAP_RES_DELETE;
+    verb     = "ldap_delete";
+  }
+  else if (tttctx->mode & RENAME_ENTRIES)
+  {
+    expected = LDAP_RES_MODRDN;
+    verb     = "ldap_rename";
+  }
+  else if (tttctx->mode & ATTR_REPLACE) /*JLS 21-11-00*/
+  {
+    expected = LDAP_RES_MODIFY;         /*JLS 21-11-00*/
+    verb     = "ldap_modify";           /*JLS 21-11-00*/
+  }
   else
-    if (tttctx->mode & DELETE_ENTRIES)
-    {
-      expected = LDAP_RES_DELETE;
-      verb     = "ldap_delete";
-    }
-    else
-      if (tttctx->mode & RENAME_ENTRIES)
-      {
-	expected = LDAP_RES_MODRDN;
-	verb     = "ldap_rename";
-      }
-      else							/*JLS 21-11-00*/
-	if (tttctx->mode & ATTR_REPLACE)			/*JLS 21-11-00*/
-	{							/*JLS 21-11-00*/
-	  expected = LDAP_RES_MODIFY;				/*JLS 21-11-00*/
-	  verb     = "ldap_modify";				/*JLS 21-11-00*/
-	}							/*JLS 21-11-00*/
+  {
+    return (-1);
+  }
 
   /*
    * Here, we are in asynchronous mode...