From 78676df2f06efb252312794bbe7704a8042a905e Mon Sep 17 00:00:00 2001 From: Eduard Shishkin Date: Wed, 15 Jul 2026 11:31:17 +0200 Subject: [PATCH] zipl-editenv: Check in-bootmap environment block validity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check decimal prefixes, representing site values in on-disk environment block. Reject any values different from {0, ..., 9} as invalid ones. Reviewed-by: Stefan Haberland Signed-off-by: Eduard Shishkin Signed-off-by: Jan Höppner --- zipl/src/envblk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zipl/src/envblk.c b/zipl/src/envblk.c index 86b7a6d1..bcd66ce5 100644 --- a/zipl/src/envblk.c +++ b/zipl/src/envblk.c @@ -675,8 +675,12 @@ static int add_line_namespace(char *this, void *data) int val; val = strtol(this, &endptr, 10); - if (endptr == this) + if (endptr == this) { val = MAX_NR_SITES; + } else if (val < 0 || val >= MAX_NR_SITES) { + error_reason("Bad site value (%d)", val); + return -EINVAL; + } if (!tables[val]) { tables[val] = util_zalloc(LINE_HASH_SIZE * sizeof(*tables));