Merge "Add snprintf truncation and output error checks."