Use snprintf(3) instead of sprintf(3).

This change should probably be made upstream as well, but they have a
note about not using it because it isn't available on all systems.

Change-Id: I6d8404c031bd2f486532ced55d94bbb4a4cd2e71
Merge "Use snprintf(3) instead of sprintf(3)."