Fix ASAN build error 78/273378/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.061431 accepted/tizen/7.0/unified/hotfix/20221116.111049 accepted/tizen/unified/20220603.141308 submit/tizen/20220405.063948 submit/tizen/20220602.012031 tizen_7.0_m2_release
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 5 Apr 2022 06:32:13 +0000 (15:32 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 5 Apr 2022 06:32:15 +0000 (15:32 +0900)
error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation]
258 |   strncpy(sau.sun_path, ads, sizeof(sau.sun_path));

Change-Id: Idc6af2ac15e88e60e2c25b837f56a0d7b104a917

lib/core-net/client/connect3.c

index a31021659d59e4bb1e17d8ebdceb3f9e8a175d49..785dd4c0f5f5ee9d5354460d6bdb53a3149aef6b 100644 (file)
@@ -255,7 +255,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
                ads++;
                memset(&wsi->sa46_peer, 0, sizeof(wsi->sa46_peer));
                af = sau.sun_family = AF_UNIX;
-               strncpy(sau.sun_path, ads, sizeof(sau.sun_path));
+               strncpy(sau.sun_path, ads, sizeof(sau.sun_path) - 1);
                sau.sun_path[sizeof(sau.sun_path) - 1] = '\0';
 
                lwsl_wsi_info(wsi, "Unix skt: %s", ads);