Newlib's strtol() is not standard-compliant

Howland, Craig D. - US craig.howland@caci.com
Wed Sep 16 19:10:40 GMT 2026


Jeff:
     strtoll() and other friends are based on the same code as strtol(), so multiple other places need the same help.  In a quick look, strtoll.c, strtoul.c, strtoull.c, strtoimax.c, and strtoumax.c, as well as probably the corresponding 6 wcs*.c files need the same edit.
                Craig

________________________________
From: Jeff Johnston <jjohnstn@redhat.com>
Sent: Tuesday, September 15, 2026 11:11 AM
To: Lavrentiev, Anton (NIH/NLM/NCBI) [C] <lavr@ncbi.nlm.nih.gov>
Cc: newlib@sourceware.org <newlib@sourceware.org>; cygwin@cygwin.com <cygwin@cygwin.com>
Subject: Re: [EXTERNAL] Re: Newlib's strtol() is not standard-compliant





Your tweak makes sense, thanks.  Compared against glibc with some extra examples with sign and whitespace.

-- Jeff J.

On Mon, Sep 14, 2026 at 10:35 PM Lavrentiev, Anton (NIH/NLM/NCBI) [C] <lavr@ncbi.nlm.nih.gov<mailto:lavr@ncbi.nlm.nih.gov>> wrote:
> A fix has been pushed to main.
>
> -- Jeff J.

Thanks.  I checked the fix but unfortunately it does not seem to be complete:

"nptr" is not tracking the leading whitespace and / or a sign
that might appear prior to "0x".  So endptr is not going to
receive a correct value, in either or both of those cases.

Maybe to assign "nptr" with the value of "s" (before bumping it by 2)
instead of doing just the ++ increment?

Anton Lavrentiev
Contractor NIH/NLM/NCBI

________________________________

This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.


More information about the Cygwin mailing list