From 457c5b7ec2d4057cd830ba2aa704c6877199c37a Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Thu, 27 Aug 2026 22:29:21 +0200 Subject: [PATCH] Reject unbounded mapping counts and duplicate disk mappings in content decoding --- cmdline/state.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmdline/state.c b/cmdline/state.c index 3c304c9e..a45dd0da 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -3234,6 +3234,14 @@ static void state_read_content(struct snapraid_state* state, const char* path, S block_off_t v_free_blocks; struct snapraid_disk* disk; + if (mapping_max >= RAID_DATA_MAX) { + /* LCOV_EXCL_START */ + decoding_error(path, f); + log_fatal(ECONTENT, "Too many data disk mappings in the content file!\n"); + exit(EXIT_FAILURE); + /* LCOV_EXCL_STOP */ + } + ret = sgetbs(f, buffer, sizeof(buffer)); if (ret < 0) { /* LCOV_EXCL_START */