Fix incorrect size passed to snprintf.
Don't use the deprecated sprintf.