Sfoglia il codice sorgente

Bug 750625 - Fix Coverity (11116) Uninitialized pointer read

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

slapd/back-ldbm/ldbm_entryrdn.c (entryrdn_lookup_dn)

Bug Description: Using uninitialized "data.data" when calling
"slapi_ch_free".  If invalid NULL arguments or invalid DN is
passed or opening cursor failed, uninitialized data.data is freed.

Fix Description: initialize data if there is a chance to call
slapi_ch_free.
Noriko Hosoi 14 anni fa
parent
commit
c92ba0b22a
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c

+ 2 - 2
ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c

@@ -1026,7 +1026,7 @@ entryrdn_lookup_dn(backend *be,
                     "entryrdn_lookup_dn: Param error: Empty %s\n",
                     NULL==be?"backend":NULL==rdn?"rdn":0==id?"id":
                     NULL==dn?"dn container":"unknown");
-        goto bail;
+        return rc;
     }
 
     *dn = NULL;
@@ -1040,6 +1040,7 @@ entryrdn_lookup_dn(backend *be,
         return rc;
     }
 
+    memset(&data, 0, sizeof(data));
     /* Make a cursor */
     rc = db->cursor(db, db_txn, &cursor, 0);
     if (rc) {
@@ -1064,7 +1065,6 @@ entryrdn_lookup_dn(backend *be,
     }
 
     /* Setting the bulk fetch buffer */
-    memset(&data, 0, sizeof(data));
     data.flags = DB_DBT_MALLOC;
 
     do {