From 237598b3417f2c5157c530f33562d34fef9a8845 Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> Date: Thu, 10 Sep 2026 10:30:44 +0200 Subject: [PATCH] bugfix: use size_t for locale conversion buffer lengths. Keep numeric token lengths and allocation arithmetic in size_t to avoid truncation and signed overflow at INT_MAX. --- fpconv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fpconv.c b/fpconv.c index 64208f8d..3fc7c4cd 100644 --- a/fpconv.c +++ b/fpconv.c @@ -97,7 +97,7 @@ static inline int valid_number_character(char ch) /* Calculate the size of the buffer required for a strtod locale * conversion. */ -static int strtod_buffer_size(const char *s) +static size_t strtod_buffer_size(const char *s) { const char *p = s; @@ -113,7 +113,7 @@ double fpconv_strtod(const char *nptr, char **endptr) { char localbuf[FPCONV_G_FMT_BUFSIZE]; char *buf, *endbuf, *dp; - int buflen; + size_t buflen; double value; /* System strtod() is fine when decimal point is '.' */