public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug string/30460] New: strtol segfaults if first argument is NULL
@ 2023-05-18 18:41 vineethrp at gmail dot com
  2023-05-18 19:34 ` [Bug string/30460] " adhemerval.zanella at linaro dot org
  0 siblings, 1 reply; 2+ messages in thread
From: vineethrp at gmail dot com @ 2023-05-18 18:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30460

            Bug ID: 30460
           Summary: strtol segfaults if first argument is NULL
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: vineethrp at gmail dot com
  Target Milestone: ---

strtol segfaults if first argument is NULL. I would expect strtol to return
EINVAL if the first argument is NULL.

We already have check for the "base"argument and returns EINVAL
https://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/strtol_l.c;h=3424c3feab9ec42d59828e3fc0dd625432d7435b;hb=5729b8ff3168111c4e959270d39dc9f4df6bb7d8#l295

Would be great to have a check for nptr as well so that programs do not crash.

Thanks

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug string/30460] strtol segfaults if first argument is NULL
  2023-05-18 18:41 [Bug string/30460] New: strtol segfaults if first argument is NULL vineethrp at gmail dot com
@ 2023-05-18 19:34 ` adhemerval.zanella at linaro dot org
  0 siblings, 0 replies; 2+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-05-18 19:34 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30460

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
The strtol is explicitly marked as '__nonnull ((1))', meaning that it is UB
calling with a NULL argument.  For functions where the associated standards do
not explicitly set NULL is supported (as for the second strtol argument), the
current practice is not to add extra overhead checks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-18 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-18 18:41 [Bug string/30460] New: strtol segfaults if first argument is NULL vineethrp at gmail dot com
2023-05-18 19:34 ` [Bug string/30460] " adhemerval.zanella at linaro dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).