Fix the Svace issue 68/75768/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 21 Jun 2016 09:15:10 +0000 (18:15 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 21 Jun 2016 09:15:10 +0000 (18:15 +0900)
- WGID : 78626 (Use of vulnerable function)

Change-Id: I78d057d26d648299b93235c0c7747391b7803939
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/bt-share-ui-view.c

index 12b0584..71370f7 100755 (executable)
@@ -248,7 +248,7 @@ static void __bt_clear_list_btn_cb(void *data,
 
 static char *__bt_get_tr_timedate(time_t timestamp)
 {
-       struct tm *pt;
+       struct tm pt;
        struct tm current_time;
        time_t rawtime;
        char buf[BT_TIMESTAMP_LEN_MAX] = { 0 };
@@ -268,11 +268,10 @@ static char *__bt_get_tr_timedate(time_t timestamp)
        cd = current_time.tm_mday;
 
        /* Get recorded time */
-       pt = localtime(&timestamp);
-       retv_if(pt == NULL, NULL);
-       ry = pt->tm_year + 1900;
-       rm = pt->tm_mon + 1;
-       rd = pt->tm_mday;
+       localtime_r(&timestamp, &pt);
+       ry = pt.tm_year + 1900;
+       rm = pt.tm_mon + 1;
+       rd = pt.tm_mday;
 
        if (cy == ry && cm == rm && cd == rd) {
                int format = 0;
@@ -281,12 +280,12 @@ static char *__bt_get_tr_timedate(time_t timestamp)
                }
 
                if (format == VCONFKEY_TIME_FORMAT_12)
-                       if (pt->tm_hour >=0 && pt->tm_hour < 12)
-                               strftime(buf, sizeof(buf), "%I:%M AM", pt);
+                       if (pt.tm_hour >=0 && pt.tm_hour < 12)
+                               strftime(buf, sizeof(buf), "%I:%M AM", &pt);
                        else
-                               strftime(buf, sizeof(buf), "%I:%M PM", pt);
+                               strftime(buf, sizeof(buf), "%I:%M PM", &pt);
                else
-                       strftime(buf, sizeof(buf), "%H:%M", pt);
+                       strftime(buf, sizeof(buf), "%H:%M", &pt);
        } else if (cy == ry && cm == rm && cd - 1 == rd) {
                return g_strdup(BT_STR_YESTERDAY);
        } else {