Improve code security posture by replacing sprintf with a safer function.