Remove compile warning messages 69/221169/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 30 Dec 2019 02:10:11 +0000 (11:10 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 30 Dec 2019 02:11:28 +0000 (11:11 +0900)
Change-Id: I35dcc3d766e23c2e6f87ea40b2c7c47fb8978303
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
parser/component/src/component_plugin_parser_handler.c
src/aul_rsc_mgr.c
src/miregex.c
src/widget.c

index 728f8c9..e8495db 100644 (file)
@@ -332,21 +332,32 @@ static int __component_icon_attr_text(xmlNode *node, void *data)
 {
        icon_t *info = (icon_t *)data;
        const char *file = (const char *)node->children->content;
-       char path[PATH_MAX];
+       char *path;
+       int size;
 
        if (file[0] == '/') {
-               snprintf(path, sizeof(path), "%s", file);
+               size = strlen(file) + 1;
+               path = (char *)malloc(size);
+               if (!path) {
+                       LOGE("Out of memory");
+                       return -1;
+               }
+
+               snprintf(path, size, "%s", file);
        } else {
-               snprintf(path, sizeof(path), "%s/shared/res/%s",
-                               __root_path, file);
-       }
+               size = strlen(__root_path) + strlen("/shared/res/") +
+                       strlen(file) + 1;
+               path = (char *)malloc(size);
+               if (!path) {
+                       LOGE("Out of memory");
+                       return -1;
+               }
 
-       info->icon = strdup(path);
-       if (!info->icon) {
-               LOGE("Failed to duplicate icon");
-               return -1;
+               snprintf(path, size, "%s/shared/res/%s", __root_path, file);
        }
 
+       info->icon = path;
+
        return 0;
 }
 
index b09c1f0..9aa623a 100755 (executable)
@@ -742,7 +742,7 @@ static const char *_get_app_resource_path(const char *rsc_folder_path)
 
 static void path_callback(char *path)
 {
-       char orig_path[MAX_PATH] = {0, };
+       char orig_path[PATH_MAX] = {0, };
        char *path_ptr = NULL;
        int path_len = 0;
        GList *tmp_list = g_list_find_custom(all_node_list, path, __compare_path);
@@ -753,11 +753,11 @@ static void path_callback(char *path)
        else {
                tmp_node_info = (resource_node_list_t *)tmp_list->data;
                path_len = strlen(path);
-               if (path_len >= MAX_PATH) {
+               if (path_len >= PATH_MAX) {
                        LOGE("path[%s] is too long", path);
                        return;
                }
-               strncpy(orig_path, path, path_len);
+               strncpy(orig_path, path, sizeof(orig_path) - path_len - 1);
                path_ptr = &orig_path[strlen(res_path) + strlen(tmp_node_info->folder)];
                g_hash_table_insert(id_list, strdup(path_ptr), strdup(tmp_node_info->type));
        }
@@ -768,7 +768,7 @@ static void __scan_dir(const char *path, void (*func)(char *))
        struct dirent **items;
        int nitems, i;
        struct stat fstat;
-       char abs_path[MAX_PATH] = {0, };
+       char abs_path[PATH_MAX] = {0, };
        char cwd[MAX_PATH] = {0, };
        char *tmp = NULL;
 
@@ -788,7 +788,7 @@ static void __scan_dir(const char *path, void (*func)(char *))
                if (items[i]->d_name[0] == '.')
                        continue;
 
-               snprintf(abs_path, MAX_PATH - 1, "%s/%s", cwd, items[i]->d_name);
+               snprintf(abs_path, sizeof(abs_path), "%s/%s", cwd, items[i]->d_name);
 
                if (g_lstat(abs_path, &fstat) != 0) {
                        LOGE("failed to retrieve info[%s]", abs_path);
index 46cf2ca..bdf3eac 100644 (file)
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <linux/limits.h>
 
 #include "miregex.h"
 #include "aul_util.h"
@@ -199,7 +200,7 @@ regex_tbl *miregex_get_regex_table()
 {
        DIR *dp;
        struct dirent *dentry = NULL;
-       char buf[MAX_LOCAL_BUFSZ];
+       char buf[PATH_MAX];
        miregex_file_info *info;
 
        if (!__need_update_miregex_tbl())
index 7e25a85..65af1d1 100644 (file)
@@ -60,7 +60,7 @@ static bool __log_init = false;
 static int __init_log(void)
 {
        int offset;
-       char buffer[256] = {0, };
+       char buffer[512] = {0, };
        char caller[255] = {0, };
        int ret;
 
@@ -98,7 +98,7 @@ API int aul_widget_write_log(const char *tag, const char *format, ...)
        time_t now;
        char time_buf[32] = {0,};
        char format_buffer[WIDGET_LOG_BUFFER_STRING_SIZE];
-       char buffer[WIDGET_LOG_BUFFER_STRING_SIZE];
+       char buffer[WIDGET_LOG_BUFFER_SIZE];
        va_list ap;
 
        if (!__log_init)