Use snprintf instead of sprintf if possible.