From e9d3a876113e61330f341ddac84f67227ef61872 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 18 Jul 2024 19:58:55 +0200 Subject: [PATCH] xstrtol: Strengthen sanity check. * lib/xstrtol.c (__xstrtol): Don't allow strtol_base to be 1. Copyright-paperwork-exempt: Yes --- ChangeLog | 5 +++++ lib/xstrtol.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 69a4afdb5f..ee73f00cc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-07-18 Alejandro Colomar + + xstrtol: Strengthen sanity check. + * lib/xstrtol.c (__xstrtol): Don't allow strtol_base to be 1. + 2024-07-18 Bruno Haible doc: Document the stack-trace and abort-debug modules. diff --git a/lib/xstrtol.c b/lib/xstrtol.c index e4bce43681..575c16d45f 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -83,7 +83,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base, __strtol_t tmp; strtol_error err = LONGINT_OK; - assure (0 <= strtol_base && strtol_base <= 36); + assure (0 == strtol_base || (2 <= strtol_base && strtol_base <= 36)); p = (ptr ? ptr : &t_ptr); -- 2.39.5