tdb: Consistency check for tdb_storev
authorVolker Lendecke <vl@samba.org>
Wed, 9 Aug 2017 08:15:27 +0000 (10:15 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 9 Aug 2017 20:34:17 +0000 (22:34 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/tdb/common/tdb.c

index a67d8fb..6beda22 100644 (file)
@@ -541,6 +541,11 @@ static int _tdb_storev(struct tdb_context *tdb, TDB_DATA key,
        for (i=0; i<num_dbufs; i++) {
                size_t dsize = dbufs[i].dsize;
 
+               if ((dsize != 0) && (dbufs[i].dptr == NULL)) {
+                       tdb->ecode = TDB_ERR_EINVAL;
+                       goto fail;
+               }
+
                dbufs_len += dsize;
                if (dbufs_len < dsize) {
                        tdb->ecode = TDB_ERR_OOM;