Fix Svace issue of SEC_DO_NOT_ASSIGN_SIZE_OF_INT 42/283242/1 accepted/tizen/unified/20221104.082248
authorYoungHun Kim <yh8004.kim@samsung.com>
Thu, 20 Oct 2022 23:18:13 +0000 (08:18 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Thu, 20 Oct 2022 23:20:21 +0000 (08:20 +0900)
Change-Id: I967f1b9c08818c86de2b5c225e5b65fb5a461386

client/src/muse_client.c
packaging/mused.spec
server/src/muse_server_private.c

index f06c17f0ec72f5e7a24cf8e2b9ae11219413e198..c2241b19fa769da8c2f48e6e17bd79edff13216e 100644 (file)
@@ -138,7 +138,7 @@ static void _mc_constructor(void)
 static int _mc_new(muse_channel_e channel)
 {
        struct sockaddr_un address;
-       int len, ret = MUSE_ERR;
+       int ret = MUSE_ERR;
        int sock_fd;
        char err_msg[MUSE_MSG_LEN_MAX] = {'\0',};
 
@@ -165,12 +165,11 @@ static int _mc_new(muse_channel_e channel)
        memset(&address, 0, sizeof(address));
        address.sun_family = AF_UNIX;
        strncpy(address.sun_path, UDS_files[channel], sizeof(address.sun_path) - 1);
-       len = sizeof(address);
 
        if (muse_core_set_nonblocking(sock_fd, false) != MM_ERROR_NONE)
                LOGE("Error - fd (%d) set blocking", sock_fd);
 
-       if ((ret = connect(sock_fd, (struct sockaddr *)&address, len)) < 0) {
+       if ((ret = connect(sock_fd, (struct sockaddr *)&address, (socklen_t)sizeof(address))) < 0) {
                strerror_r(errno, err_msg, MUSE_MSG_LEN_MAX);
                LOGE("[Critical Error : %d] connect failure : %s", errno, err_msg);
                close(sock_fd);
index 23888504ed9e38d55ee4edadad7720fdba405416..c0c3fed99b12adf9dd982e009ac49003b6dbc265 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.155
+Version:    0.3.156
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index e24a0e01aaa5d5f1c28706571db8eb3177dddd6d..74a7fba92c5e5f0e6ce55e712732179fa5ee4aa5 100644 (file)
@@ -179,7 +179,7 @@ static int _ms_new(muse_channel_e channel)
        memset(&addr_un, 0, sizeof(addr_un));
        addr_un.sun_family = AF_UNIX;
        strncpy(addr_un.sun_path, UDS_files[channel], sizeof(addr_un.sun_path) - 1);
-       address_len = sizeof(addr_un);
+       address_len = (socklen_t)sizeof(addr_un);
 
        /* Bind to filename */
        if (bind(fd, (struct sockaddr *)&addr_un, address_len) < 0) {
@@ -216,7 +216,7 @@ static int _ms_get_pid(int fd)
        struct ucred credentials;
        socklen_t length;
 
-       length = sizeof(struct ucred);
+       length = (socklen_t)sizeof(struct ucred);
        if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &credentials, &length) < 0) {
                strerror_r(errno, err_msg, MUSE_MSG_LEN_MAX);
                LOGE("failed to get the value of credential type %s", err_msg);
@@ -294,7 +294,7 @@ static gboolean _ms_connection_handler(GIOChannel *source, GIOCondition conditio
                ms_terminate(SIGABRT);
        }
 
-       client_len = sizeof(client_address);
+       client_len = (socklen_t)sizeof(client_address);
 
        LOGI("[%d] Try to accept...", server_sockfd);
        client_sockfd = accept(server_sockfd, (struct sockaddr *)&client_address, &client_len);