%n looks like one of those mis-features that not only never should have been implemented but it is worth breaking backwards compatibility to remove.
Programmers should be able to assume that printf isn't writing to memory under ordinary operation.
Programmers should be able to assume that printf isn't writing to memory under ordinary operation.
> The %n conversion specifier has serious security implications, so it was changed to no longer store the number of bytes written so far into the variable indicated by the pointer argument. Instead a syslog(3) message will be generated, after which the program is aborted with SIGABRT.
But looking at it now from a more practical point of view, I guess I can't see how that would happen, even with aggressive compiler optimisations (which are the usual thing to trigger really surprising consequences of undefined behaviours).