UB status of snprintf on invalid ptr+size combination?

Andreas Schwab schwab@linux-m68k.org
Sat Mar 18 15:01:07 GMT 2023


On Mär 18 2023, Vincent Lefevre wrote:

> However, I'm wondering whether such a change is intentional. BTW,
> this description is even wrong: this is certainly not equivalent!
> If the untruncated output is larger than n, then the call is UB
> with sprintf(), while the output is truncated with snprintf().

Which makes them equivalent in all situations where sprintf is defined,
so there is no discrepancy here.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list