From 72fb353b5d7a8444fd6019be2fbf1e70bf026b9f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 22 Feb 2026 13:23:45 -0800 Subject: [PATCH] xfree86: issue error if too many clocks entries are listed in config Changes message issued for too many clocks from the confusing: "29.0" is not a valid keyword in this section. to the more obvious: More than 128 Clocks defined. Signed-off-by: Alan Coopersmith Part-of: --- hw/xfree86/parser/Configint.h | 2 ++ hw/xfree86/parser/Device.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h index 12b36effd..7f1e28817 100644 --- a/hw/xfree86/parser/Configint.h +++ b/hw/xfree86/parser/Configint.h @@ -206,6 +206,8 @@ else\ "The number \"%d\" given in this section must be in octal (0xxx) format." #define GPU_DEVICE_TOO_MANY \ "More than %d GPU devices defined." +#define CLOCKS_TOO_MANY \ +"More than %d Clocks defined." /* Warning messages */ #define OBSOLETE_MSG \ diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c index 383d97686..0d2167fdd 100644 --- a/hw/xfree86/parser/Device.c +++ b/hw/xfree86/parser/Device.c @@ -209,6 +209,8 @@ xf86parseDeviceSection(void) ptr->dev_clock[i] = (int) (xf86_lex_val.realnum * 1000.0 + 0.5); token = xf86getSubToken(&(ptr->dev_comment)); } + if (token == NUMBER && i >= CONF_MAXCLOCKS) + Error(CLOCKS_TOO_MANY, CONF_MAXCLOCKS); ptr->dev_clocks = i; xf86unGetToken(token); break;