I have a C++ program for which validated API users (not interactive users, so there is no major security/integrity exposure here) can pass a parameter that becomes a format string for printf() (actually, for vsnprintf()). Of course, bad format specifiers make the program blow up. I have documented that and it is acceptable -- but is there any way to trap printf() errors rather than having the C runtime assert?
Environment is pretty much standard Posix (z/OS XLC, FWIW).