Handle potential integer overflow in snprintf()/printf().