C strtol() bites PHP: "0x0 +2" = 4, "0x0 +2e1" = 757 https://www.reddit.com/r/lolphp/comments/ps6x5/0x0_wat/ … h/t @spun_off How to strtoul() http://lists.openwall.net/phc-discussions/2015/09/30/3 … (or not)
-
-
Yes, strspn() was excessive. I've since simplified that function. Still need to set/check errno and for repeating 0's.
-
Also, as you know, isdigit() is only defined for int, not char, so need (int)(unsigned char)*s or range check instead.
-
Indeed. I would just do the range test in practice; only '0' thru '9' are permitted in digit class anyway.
-
Not to mention, assuming their contiguous is portable to malicious C implementations, not even just ASCII :)
End of conversation
New conversation -
-
-
I'd have recommended to use tools proven by 30 years of compiler generation, but awareness about strtol() pitfalls is good, too…
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.