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
This commit is contained in:
Dan Albert 2014-10-08 17:10:26 -07:00
parent 72d72d9126
commit ca75f9cdeb
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ asctime_r(register const struct tm *timeptr, char *buf)
/*
** We avoid using snprintf since it's not available on all systems.
*/
(void) sprintf(result,
(void) snprintf(result, sizeof(result), /* Android change: use snprintf. */
((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
wn, mn,
timeptr->tm_mday, timeptr->tm_hour,