pass-hal: tm1: Send exact size of pmqos data 67/213767/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.034306 accepted/tizen/5.5/unified/mobile/hotfix/20201027.082444 accepted/tizen/5.5/unified/wearable/hotfix/20201027.123632 accepted/tizen/unified/20190916.111608 submit/tizen/20190916.022543 submit/tizen_5.5/20191031.000010 submit/tizen_5.5/20191031.000011 submit/tizen_5.5/20191031.000013 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 05:24:45 +0000 (14:24 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 11 Sep 2019 07:22:26 +0000 (16:22 +0900)
To prevent buffer overflow, sends exact size of pmqos data.

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

index 7e8f8e16d12e9e2a3a9b6cc060117e82fccb6c69..7392d3959161a89323b84ef0969d2812c9b762bd 100644 (file)
@@ -36,7 +36,7 @@ static int tm1_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 tm1_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;