Fix use cases of snprintf.