Fix SVACE issues : WID 4031072, WID 4010761 95/68795/1 accepted/tizen_3.0_ivi accepted/tizen_common accepted/tizen_ivi tizen_3.0 accepted/tizen/3.0/ivi/20161011.050549 accepted/tizen/common/20160511.142402 accepted/tizen/ivi/20160512.051209 submit/tizen/20160511.101045 submit/tizen_3.0_ivi/20161010.000004
authorgs86.lee <gs86.lee@samsung.com>
Tue, 10 May 2016 00:52:09 +0000 (09:52 +0900)
committergs86.lee <gs86.lee@samsung.com>
Tue, 10 May 2016 00:52:09 +0000 (09:52 +0900)
Change-Id: I7761e330e971a6664ec4bddf8e4cfef3c3d2ee54

src/util_time.c

index de62c69..e16770b 100644 (file)
@@ -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);
        }