From: Alejandro Colomar Date: Thu, 18 Jul 2024 17:58:55 +0000 (+0200) Subject: xstrtol: Strengthen sanity check. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=e9d3a876113e61330f341ddac84f67227ef61872;p=gnulib.git xstrtol: Strengthen sanity check. * lib/xstrtol.c (__xstrtol): Don't allow strtol_base to be 1. Copyright-paperwork-exempt: Yes --- 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);