]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2026-58224: ctdb-daemon: Avoid out of bounds data access
authorMartin Schwenke <mschwenke@ddn.com>
Sat, 30 May 2026 07:35:23 +0000 (17:35 +1000)
committerBjoern Jacke <bjacke@samba.org>
Tue, 28 Jul 2026 15:56:37 +0000 (15:56 +0000)
The count can't exceed the recdata buffer size.

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

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Tristan Madani <tristan@talencesecurity.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
ctdb/server/ctdb_update_record.c

index 405499c81e261a7f9beea1bce8fc116617b273e3..154b142741095f9ae402ee32d54ade3fdd41efe5 100644 (file)
@@ -318,6 +318,16 @@ int32_t ctdb_control_update_record(struct ctdb_context *ctdb,
        struct childwrite_handle *handle;
        struct ctdb_marshall_buffer *m = (struct ctdb_marshall_buffer *)recdata.dptr;
 
+       if (recdata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
+               DBG_ERR("Invalid packet\n");
+               return -1;
+       }
+       if (m->count >
+           recdata.dsize - offsetof(struct ctdb_marshall_buffer, data)) {
+               DBG_ERR("Invalid packet\n");
+               return -1;
+       }
+
        if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
                DEBUG(DEBUG_INFO,("rejecting ctdb_control_update_record when recovery active\n"));
                return -1;