test: replace sprintf() with snprintf()

There is zero risk of overflowing the buffer, it's just a good habit.