News for hackers. Stuff that matters.
Re:C23 is finished: Here is what is on the menu by teddyh on Friday August 05, 2022 @05:59AM (#32353897)
For printf(), that would work. For sscanf(), POSIX could add macros there, too, but sscanf() does not detect integer overflow. That’s why the only previous solution was strtoimax() which does detect overflow.
Re:C23 is finished: Here is what is on the menu by rwmj on Friday August 05, 2022 @06:12AM (#32354003)
scanf not detecting integer overflow is arguably another problem. It's usually the easiest way to parse numbers out of simple strings, but the lack of overflow detection is a problem. (Actually we use sscanf for this and ignore the overflow problem, as long as it doesn't cause any security or correctness concern.) IIRC glibc actually does overflow detection, so there's not anything inherently problematic with adding it.