From a878171cb432673f635a75cce0b72c92bb0d3ec7 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 11 Sep 2017 14:05:17 +1000 Subject: [PATCH] ctdb-client: Initialize ctdb_ltdb_header completely for empty record 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. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/client/client_db.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ctdb/client/client_db.c b/ctdb/client/client_db.c index e3eaf7dd106..e86830e7bfb 100644 --- a/ctdb/client/client_db.c +++ b/ctdb/client/client_db.c @@ -1116,9 +1116,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;