Fix a potential buffer over flow issue (WID:32365704) 16/151516/1
authorsaerome kim <saerome.kim@samsung.com>
Thu, 21 Sep 2017 06:35:39 +0000 (15:35 +0900)
committersaerome kim <saerome.kim@samsung.com>
Thu, 21 Sep 2017 06:35:39 +0000 (15:35 +0900)
Change-Id: Ia6100bb40339cc49633a594994edc10f282ee369
Signed-off-by: saerome kim <saerome.kim@samsung.com>
src/wifi-mesh.c

index f59da7e2c5559a696d475b7c4326fb10606f88ff..9e37a95089ab2fe251003c4e91ebace940c20dfc 100644 (file)
@@ -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);