[haiku-bugs] [Haiku] #10909: [easy] strtol doesn't handle overflow properly

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Fri, 06 Jun 2014 15:12:25 -0000

#10909: [easy] strtol doesn't handle overflow properly
--------------------------+------------------------------
 Reporter:  pulkomandy    |        Owner:  nobody
     Type:  bug           |       Status:  new
 Priority:  normal        |    Milestone:  R1
Component:  System/POSIX  |      Version:  R1/Development
 Keywords:                |   Blocked By:
 Blocking:                |  Has a Patch:  0
 Platform:  All           |
--------------------------+------------------------------
 When trying to parse a number too big to fit a long, strtol returns 0
 instead of LONG_MAX. If I read the POSIX spec correctly, it should:
  * Set end to the character after the last digit in the string
  * Set errno to ERANGE
  * Return LONG_MAX.

 See attached test program.

 http://pubs.opengroup.org/onlinepubs/007904875/functions/strtol.html

--
Ticket URL: <https://dev.haiku-os.org/ticket/10909>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: