]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ldb: check return values
authorAndrej Gessel <Andrej.Gessel@janztec.com>
Fri, 15 Jun 2018 09:02:15 +0000 (11:02 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 26 Jun 2018 07:19:17 +0000 (09:19 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13475

Signed-off-by: Andrej Gessel <Andrej.Gessel@janztec.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6b52d21e6040699a72aff12fd6ebb34534dcb457)

lib/ldb/ldb_tdb/ldb_index.c
lib/ldb/ldb_tdb/ldb_search.c

index 290d9b6482b880b528dfa72f4734162492d73715..21d501d4ee515255f1b6303c7688f633db9a9a21 100644 (file)
@@ -433,6 +433,10 @@ normal_index:
 
                list->count = el->values[0].length / LTDB_GUID_SIZE;
                list->dn = talloc_array(list, struct ldb_val, list->count);
+               if (list->dn == NULL) {
+                       talloc_free(msg);
+                       return LDB_ERR_OPERATIONS_ERROR;
+               }
 
                /*
                 * The actual data is on msg, due to
@@ -621,6 +625,9 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
        }
 
        key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
+       if (key.dptr == NULL) {
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
        key.dsize = strlen((char *)key.dptr);
 
        rec = tdb_fetch(ltdb->idxptr->itdb, key);
index af7393deda7dc619988fc5946fefb6ffeacf047b..fdae4cba62b98518d5e67b7dc395976479177870 100644 (file)
@@ -102,8 +102,11 @@ static int msg_add_distinguished_name(struct ldb_message *msg)
        el.values = &val;
        el.flags = 0;
        val.data = (uint8_t *)ldb_dn_alloc_linearized(msg, msg->dn);
+       if (val.data == NULL) {
+               return -1;
+       }
        val.length = strlen((char *)val.data);
-       
+
        ret = msg_add_element(msg, &el, 1);
        return ret;
 }