]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-client: Initialize ctdb_ltdb_header completely for empty record
authorAmitay Isaacs <amitay@gmail.com>
Mon, 11 Sep 2017 04:05:17 +0000 (14:05 +1000)
committerStefan Metzmacher <metze@samba.org>
Sat, 16 Sep 2017 11:34:33 +0000 (13:34 +0200)
ctdb_ltdb_fetch() only fills in relevant portion of ctdb_ltdb_header
if the record does not exist.  This can result in uninitialized writes
to ctdb_rec_buffer.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13036

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit a878171cb432673f635a75cce0b72c92bb0d3ec7)

Autobuild-User(v4-7-test): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(v4-7-test): Sat Sep 16 13:34:33 CEST 2017 on sn-devel-144

ctdb/client/client_db.c

index 05645f54075173da29732902146bd4edb98871c9..237806756f8d7523869a164e8b44d94d09b56f84 100644 (file)
@@ -1114,9 +1114,9 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *db, TDB_DATA key,
                        return EIO;
                }
 
-               header->rsn = 0;
-               header->dmaster = CTDB_UNKNOWN_PNN;
-               header->flags = 0;
+               *header = (struct ctdb_ltdb_header) {
+                       .dmaster = CTDB_UNKNOWN_PNN,
+               };
 
                if (data != NULL) {
                        *data = tdb_null;