From 52cd89abcfae97c6de6d55b4637d0a9d83641575 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Thu, 21 Sep 2017 15:35:39 +0900 Subject: [PATCH] Fix a potential buffer over flow issue (WID:32365704) Change-Id: Ia6100bb40339cc49633a594994edc10f282ee369 Signed-off-by: saerome kim --- src/wifi-mesh.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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); -- 2.34.1