From 5aec9ad78df25df2f0fd83cbe631e3655f92f3c6 Mon Sep 17 00:00:00 2001 From: Soma Aishwarya Date: Fri, 31 Jul 2026 23:08:00 +0530 Subject: [PATCH] fix stack overread on truncated range in cpulist parse_entry --- src/linux/cpulist.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/linux/cpulist.c b/src/linux/cpulist.c index f6c4c291..e3a4e171 100644 --- a/src/linux/cpulist.c +++ b/src/linux/cpulist.c @@ -111,6 +111,15 @@ inline static bool parse_entry( } const char* number_start = number_end + 1; + if (number_start == entry_end) { + /* Nothing follows the '-' separator; ignore the entry */ + cpuinfo_log_warning( + "missing end of range in the cpu list entry \"%.*s\": entry is ignored", + (int)entry_length, + entry_start); + return false; + } + number_end = parse_number(number_start, entry_end, &last_cpu); if (number_end == number_start) { /* Failed to parse the second number; ignore the entry */