Re: [PATCH v1] man/man3/strtoul.3: BUGS: Signed numbers are not rejected

Alejandro Colomar
2025-03-21T22:21:33Z

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Hi,

On Fri, Mar 21, 2025 at 10:31:39PM +0100, Bruno Haible wrote:
> Alejandro Colomar wrote:
> > This is one of the patches I will apply after your report. Please
> > review.
>
> Looks good to me, except for one line in the sample:
>
> > + if (!isxdigit((unsigned char) *s))
>
> For a general base, this should be
>
> if (!isalnum((unsigned char) *s))

Hmmm, thanks! I fogot about base 29. :)
I'll take that for v3.

>
> For base <= 16, it can be simplified to
>
> if (!isxdigit((unsigned char) *s))
>
> For base <= 10, it can be simplified to
>
> if (!isdigit((unsigned char) *s))

Yep, although I won't mention that. Since isalnum(3) works for all,
I'll say that.

Cheers,
Alex

--
<https://www.alejandro-colomar.es/>