Fix bug: sprintf() was used where snprintf() was meant.