Changed various sprintf calls to snprintf.