Use snprintf instead of sprintf to avoid security warnings regarding buffer overflow potential of sprintf.