Thread (24 messages) 24 messages, 2 authors, 2025-03-23

[PATCH v3 0/2] strto[u]l.3: BUGS and CAVEATS

From: Alejandro Colomar <alx@kernel.org>
Date: 2025-03-23 00:30:33

Hi!

Here's v3, suggesting alnum(3) instead of isxdigit(3), and also making
the wording slightly more precise, since not all negative numbers are
accepted; only some (I don't feel like explaining it with details; it's
easier to just say it's a bug to be workarounded).  Add a link.


Cheers,
Alex

Alejandro Colomar (2):
  man/man3/strto[u]l.3: BUGS: Signed numbers and white space are not
    rejected
  man/man3/strtol.3: CAVEATS: Clarify how to perform range checks

 man/man3/strtol.3  | 20 ++++++++++++++++++++
 man/man3/strtoul.3 | 19 ++++++++++++++-----
 2 files changed, 34 insertions(+), 5 deletions(-)

Range-diff against v2:
1:  8faa6a809 ! 1:  3c456a1a0 man/man3/strto[u]l.3: BUGS: Signed numbers and white space are not rejected
    @@ Metadata
      ## Commit message ##
         man/man3/strto[u]l.3: BUGS: Signed numbers and white space are not rejected
     
    +    Link: <https://stackoverflow.com/questions/60955490/strtoul-what-is-the-correct-return-value-for-very-negative-strings>
         Reported-by: Bruno Haible [off-list ref]
         Signed-off-by: Alejandro Colomar [off-list ref]
     
    @@ man/man3/strtoul.3: .SH CAVEATS
     -value.
     +.SH BUGS
     +.SS Signed numbers
    -+Negative values
    ++Some negative values
     +are considered valid input and
     +are silently converted to
     +.IR "\%unsigned\ long" .
     +.SS White space
     +These functions silently accept leading whitespace.
    -+.SS isxdigit(3)
    ++.SS isalnum(3)
     +One should call
    -+.BR isxdigit (3)
    ++.BR isalnum (3)
     +before
     +.BR strtoul ()
     +to reject white space and/or a sign.
2:  b5244e62c = 2:  020b468a3 man/man3/strtol.3: CAVEATS: Clarify how to perform range checks

base-commit: e921861a3d30cfc5f9263747a4e64a68e488288c
-- 
2.47.2

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help