From: Ronnie Sahlberg Date: Fri, 28 Oct 2011 00:44:19 +0000 (+1100) Subject: ReadOnly: fix bug writing incorrect amount of data in delegated record X-Git-Url: http://git.samba.org/?p=sahlberg%2Fctdb.git;a=commitdiff_plain;h=8814d8bc159a5e368afaa236ac7d865165db04b2 ReadOnly: fix bug writing incorrect amount of data in delegated record Fix bug when ctdbd updates the local copy of a delegated record to write the correct amount of data to the record. --- diff --git a/server/ctdb_call.c b/server/ctdb_call.c index 9fc8b339..23d10b92 100644 --- a/server/ctdb_call.c +++ b/server/ctdb_call.c @@ -741,8 +741,14 @@ void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) goto finished_ro; } + if (c->datalen < sizeof(struct ctdb_ltdb_header)) { + DEBUG(DEBUG_ERR,(__location__ " Got FETCH_WITH_HEADER reply with too little data: %d bytes\n", c->datalen)); + ctdb_ltdb_unlock(ctdb_db, key); + goto finished_ro; + } + + data.dsize = c->datalen - sizeof(struct ctdb_ltdb_header); data.dptr = &c->data[sizeof(struct ctdb_ltdb_header)]; - data.dsize = sizeof(struct ctdb_ltdb_header); ret = ctdb_ltdb_store(ctdb_db, key, header, data); if (ret != 0) { DEBUG(DEBUG_ERR, ("Failed to store new record in ctdb_reply_call\n"));