pass-hal: tw3: Send exact size of pmqos data 72/213772/2 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.004217 accepted/tizen/5.5/unified/mobile/hotfix/20201027.081631 accepted/tizen/5.5/unified/wearable/hotfix/20201027.123011 accepted/tizen/unified/20190916.111614 submit/tizen/20190916.022543 submit/tizen_5.5/20191031.000010 submit/tizen_5.5_mobile_hotfix/20201026.185101 submit/tizen_5.5_wearable_hotfix/20201026.184301 tizen_5.5.m2_release
authorDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 11 Sep 2019 06:39:17 +0000 (15:39 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 11 Sep 2019 07:30:38 +0000 (16:30 +0900)
To prevent buffer overflow, sends exact size of pmqos data.

Change-Id: Ia4d1a91e15464e747e8874d30f99d0d1a8087972
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
src/nonstandard/nonstandard.c

index 0aa620a..70b01d7 100644 (file)
@@ -36,7 +36,7 @@ static int tw3_set_pmqos_data(char *res_name, void *data)
        struct sockaddr_un addr;
        int socket_fd, ret;
 
-       if (!res_name)
+       if (!res_name || !data)
                return -EINVAL;
 
        errno = 0;
@@ -56,7 +56,7 @@ static int tw3_set_pmqos_data(char *res_name, void *data)
        }
 
        errno = 0;
-       ret = send(socket_fd, data, NAME_MAX, MSG_NOSIGNAL);
+       ret = send(socket_fd, data, strlen(data) + 1, MSG_NOSIGNAL);
        if (ret)
                ret = errno;