[SVACE] Fix dereference problem 21/87321/2 accepted/tizen/common/20160907.154828 submit/tizen/20160907.102659 submit/tizen/20160909.002354
authorsooyeon.kim <sooyeon.kim@samsung.com>
Wed, 7 Sep 2016 10:23:38 +0000 (19:23 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Wed, 7 Sep 2016 10:36:46 +0000 (19:36 +0900)
Change-Id: Icaf8b79c7ffb9e248ccbfdb5527fd53fc059f2f9
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
server/sttd_client_data.c

index fafb50d..4ea6667 100644 (file)
@@ -402,10 +402,18 @@ int sttd_client_get_list(int** uids, int* uid_count)
        int i = 0;
 
        iter = g_slist_nth(g_client_list, 0);
        int i = 0;
 
        iter = g_slist_nth(g_client_list, 0);
-       for (i = 0; i < count; i++) {
+       while (NULL != iter) {
+               if (NULL == iter->data) {
+                       count--;
+                       iter = g_slist_next(iter);
+                       continue;
+               }
+
                data = iter->data;
                tmp[i] = data->uid;
                iter = g_slist_next(iter);
                data = iter->data;
                tmp[i] = data->uid;
                iter = g_slist_next(iter);
+
+               i++;
        }
 
        *uids = tmp;
        }
 
        *uids = tmp;
@@ -466,4 +474,4 @@ bool stt_client_get_app_agreed(int uid)
 
        hnd = tmp->data;
        return hnd->app_agreed;
 
        hnd = tmp->data;
        return hnd->app_agreed;
-}
\ No newline at end of file
+}