From: saerome kim Date: Thu, 21 Sep 2017 06:35:39 +0000 (+0900) Subject: Fix a potential buffer over flow issue (WID:32365704) X-Git-Tag: submit/tizen/20170921.072433^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52cd89abcfae97c6de6d55b4637d0a9d83641575;p=platform%2Fcore%2Fapi%2Fwifi-mesh.git Fix a potential buffer over flow issue (WID:32365704) Change-Id: Ia6100bb40339cc49633a594994edc10f282ee369 Signed-off-by: saerome kim --- diff --git a/src/wifi-mesh.c b/src/wifi-mesh.c index f59da7e..9e37a95 100644 --- a/src/wifi-mesh.c +++ b/src/wifi-mesh.c @@ -697,7 +697,7 @@ EXPORT_API int wifi_mesh_set_softap(wifi_mesh_h handle, const char* ssid, int max_stations, int security) { int rv = 0; - char buf[32] = {0,}; + char buf[2] = {0,}; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); if (NULL == handle || ssid == NULL || key == NULL) { @@ -707,10 +707,14 @@ EXPORT_API int wifi_mesh_set_softap(wifi_mesh_h handle, const char* ssid, /* LCOV_EXCL_STOP */ } - if (channel <= 13) - memcpy(buf, "g", strlen("g")); - else - memcpy(buf, "a", strlen("a")); + if (channel <= 13) { + buf[0] = 'g'; + buf[1] = 0; + } + else { + buf[0] = 'a'; + buf[1] = 0; + } rv = _wifi_mesh_set_softap(handle, ssid, key, buf, channel, visibility, max_stations, security);