Remove 'stringop-truncation' warning for GCC-9
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 30 Dec 2019 02:06:15 +0000 (11:06 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 30 Dec 2019 07:36:40 +0000 (16:36 +0900)
Change-Id: I5f5d364ec1245300705be1364291121511aa81cd
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/device_manager_io.c
src/device_manager_plugin_emul.c

index 717ecd5..3e527c1 100644 (file)
@@ -156,7 +156,8 @@ int sys_get_str(char *fname, char* str)
        char buf[BUFF_MAX] = {0};
 
        if (sys_read_buf(fname, buf) == 0) {
-               strncpy(str, buf, strlen(buf));
+               memset(str, 0, strlen(buf) + 1);
+               memcpy(str, buf, strlen(buf));
                return 0;
        }
 
index 6f0e226..07e3d43 100644 (file)
@@ -264,7 +264,7 @@ static int OEM_sys_display_info(struct display_info *disp_info)
                        if (!strncmp(".", dent->d_name, sizeof(".")) || !strncmp("..", dent->d_name, sizeof("..")))
                                continue;
                        else {
-                               strncpy(disp_info[index].bl_name, dent->d_name, sizeof(disp_info[index].bl_name) - 1);
+                               memcpy(disp_info[index].bl_name, dent->d_name, sizeof(disp_info[index].bl_name) - 1);
                                index++;
                        }
                }
@@ -287,7 +287,7 @@ static int OEM_sys_display_info(struct display_info *disp_info)
                        if (!strncmp(".", dent->d_name, sizeof(".")) || !strncmp("..", dent->d_name, sizeof("..")))
                                continue;
                        else {
-                               strncpy(disp_info[index].lcd_name, dent->d_name, sizeof(disp_info[index].lcd_name) - 1);
+                               memcpy(disp_info[index].lcd_name, dent->d_name, sizeof(disp_info[index].lcd_name) - 1);
                                index++;
                        }
                }