RFR 9: 8074818: Resolve disabled warnings for libjava

Martin Buchholz martinrb at google.com
Fri May 22 17:54:47 UTC 2015


I agree it's a good idea to increase safety by replacing calls to *printf
with calls to *nprintf, BUT when we do so we should also add debugging
assertions that the message fits into the buffer.

-    sprintf(errmsg, format, errnum, detail);
+    snprintf(errmsg, fmtsize, IOE_FORMAT, errnum, detail);

How about

int needed = snprintf(...)
assert(needed <= fmtsize);



More information about the build-dev mailing list