From 2ad16980e24c178a1cfdbc28bcb4bf74db109e42 Mon Sep 17 00:00:00 2001 From: "gs86.lee" Date: Tue, 10 May 2016 09:52:09 +0900 Subject: [PATCH] Fix SVACE issues : WID 4031072, WID 4010761 Change-Id: I7761e330e971a6664ec4bddf8e4cfef3c3d2ee54 --- src/util_time.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/util_time.c b/src/util_time.c index de62c69..e16770b 100644 --- a/src/util_time.c +++ b/src/util_time.c @@ -90,12 +90,12 @@ static i18n_udate_format_h __util_time_date_formatter_get(const char *locale, co static i18n_udate_format_h __util_time_time_formatter_get(bool use24hformat, const char *locale, const char *timezone_id) { - char buf[64] = {0,}; + char buf[128] = { 0, }; int status; - i18n_uchar u_pattern[64] = {0,}; - i18n_uchar u_best_pattern[64] = {0,}; + i18n_uchar u_pattern[128] = { 0, }; + i18n_uchar u_best_pattern[128] = { 0, }; int32_t u_best_pattern_capacity, u_best_pattern_len; - char a_best_pattern[128] = {0,}; + char a_best_pattern[128] = { 0, }; i18n_udate_format_h formatter = NULL; @@ -106,10 +106,10 @@ static i18n_udate_format_h __util_time_time_formatter_get(bool use24hformat, con } if (use24hformat) { - snprintf(buf, sizeof(buf)-1, "%s", "HH:mm"); + snprintf(buf, sizeof(buf), "%s", "HH:mm"); } else { /* set time format 12 */ - snprintf(buf, sizeof(buf)-1, "%s", "h:mm"); + snprintf(buf, sizeof(buf), "%s", "h:mm"); } i18n_ustring_copy_ua_n(u_pattern, buf, sizeof(u_pattern)); @@ -126,8 +126,9 @@ static i18n_udate_format_h __util_time_time_formatter_get(bool use24hformat, con i18n_ustring_copy_au(a_best_pattern, u_best_pattern); - char *a_best_pattern_fixed = strtok(a_best_pattern, "a"); - a_best_pattern_fixed = strtok(a_best_pattern_fixed, " "); + char *saveptr= NULL; + char *a_best_pattern_fixed = strtok_r(a_best_pattern, "a", &saveptr); + a_best_pattern_fixed = strtok_r(a_best_pattern_fixed, " ", &saveptr); if (a_best_pattern_fixed) { i18n_ustring_copy_ua(u_best_pattern, a_best_pattern_fixed); } -- 2.7.4