[FIX] Svace issues 50/71850/1 accepted/tizen/common/20160527.153815 accepted/tizen/ivi/20160530.081417 accepted/tizen/mobile/20160530.081523 accepted/tizen/tv/20160530.081341 accepted/tizen/wearable/20160530.081330 submit/tizen/20160527.105210
authorAnatolii Nikulin <nikulin.a@samsung.com>
Fri, 27 May 2016 10:11:40 +0000 (13:11 +0300)
committerAnatolii Nikulin <nikulin.a@samsung.com>
Fri, 27 May 2016 10:13:07 +0000 (13:13 +0300)
|-------------------------------------------------------|
| WGID  | Type                      | File              |
|-------------------------------------------------------|
| 83591 | NO_UNLOCK                 | ui_viewer_utils.c |
| 83589 | STATIC_OVERFLOW.SCANF     | ui_viewer_lib.c   |
| 83587 | PROC_USE.VULNERABLE       | ui_viewer_data.c  |
| 83586 | PROC_USE.VULNERABLE       | ui_viewer_utils.c |
| 83594 | NO_EFFECT                 | ui_viewer.c       |
|-------------------------------------------------------|

Change-Id: I3c4f6a4a22836d541c083ad89c3694df889ffc47
Signed-off-by: Anatolii Nikulin <nikulin.a@samsung.com>
daemon/ui_viewer.c
ui_viewer/ui_viewer_data.c
ui_viewer/ui_viewer_data.h
ui_viewer/ui_viewer_lib.c
ui_viewer/ui_viewer_utils.c

index 59bcd2b..78a0b43 100644 (file)
@@ -54,12 +54,6 @@ int ui_viewer_set_app_info(const struct app_info_t *app_info)
        int ret = 0, c = 0;
        uint64_t main_offset;
 
-       if (app_info->setup_data.data == NULL) {
-               LOGE("Setup data path is not correct\n");
-               ret = -EINVAL;
-               goto fail;
-       }
-
        main_offset = *(uint64_t*)app_info->setup_data.data;
 
        if (app_info->exe_path == NULL || !strlen(app_info->exe_path)) {
index cc5d9d3..600740f 100644 (file)
@@ -1392,8 +1392,8 @@ static void pack_ui_obj_prop(int file, Evas_Object *obj, const char *type_name)
                ui_obj_elm_prop_t elm_prop;
 
                if (!strcmp(type_name, "elm_pan")) {
-                       strcpy(elm_prop.text, "");
-                       strcpy(elm_prop.style, "");
+                       elm_prop.text[0] = '\0';
+                       elm_prop.style[0] = '\0';
                        elm_prop.disabled = 0;
                } else {
                        _strncpy(elm_prop.text, elm_object_text_get(obj), MAX_TEXT_LENGTH);
index 0e48558..ea13ec4 100644 (file)
@@ -32,6 +32,9 @@
 #define MAX_PATH_LENGTH                256
 #define MAX_TEXT_LENGTH                1024
 
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
 enum ErrorCode {
        ERR_NO                          = 0,    /* success */
        ERR_ALREADY_RUNNING             = -102, /* already running */
index eee16d8..0d13133 100644 (file)
@@ -98,7 +98,7 @@ void application_exit()
        snprintf(buf, sizeof(buf), "/proc/%d/cmdline", gpid);
        f = fopen(buf, "r");
        if (f != NULL) {
-               fscanf(f, "%s", buf);
+               fscanf(f, "%" TOSTRING(MAX_PATH_LENGTH) "s", buf);
                fclose(f);
                if (strlen(buf) == strlen(manager_name) &&
                    strncmp(buf, manager_name, sizeof(manager_name)) == 0) {
index be2ab1e..0623a9f 100644 (file)
@@ -185,16 +185,17 @@ bool print_log_fmt(int msgType, const char *func_name, int line, ...)
 static int tmp_file_open(struct temp_file_t *tmp_file)
 {
        char template_name[] = TMP_DIR"/swap_ui_viewer_XXXXXX";
+       size_t len = strlen(template_name);
 
        int file = mkstemp(template_name);
        if (file == -1)
                return -1;
 
-       tmp_file->name = malloc(strlen(template_name) + 1);
+       tmp_file->name = malloc(len + 1);
        if (tmp_file->name == NULL)
                goto tmp_file_open_no_mem;
 
-       strcpy(tmp_file->name, template_name);
+       strncpy(tmp_file->name, template_name, len + 1);
 
        tmp_file->file = file;
 
@@ -352,15 +353,16 @@ void ui_viewer_clean_log(void)
 void ui_viewer_log(const char *format, ...)
 {
        FILE *fp;
-       va_list args;
 
        pthread_mutex_lock(&log_lock);
        fp = fopen(log_filename, "a");
-       if (fp == NULL)
-               return;
-       va_start (args, format);
-       vfprintf (fp, format, args);
-       va_end (args);
-       fclose(fp);
+       if (fp) {
+               va_list args;
+
+               va_start (args, format);
+               vfprintf (fp, format, args);
+               va_end (args);
+               fclose(fp);
+       }
        pthread_mutex_unlock(&log_lock);
 }