framework/st_things: fix ssid format
artik053 supports 32 bytes for ssid.
limit the length of ssid.
@@ -661,17 +661,21 @@ wifi_manager_softap_config_s *dm_get_softap_wifi_config(void)
st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)(0));
int ssid_type = (is_artik == true ? 1 : 0);
unsigned char mac_id[16] = { 0, };
+ char ssid_device_name[17];
+
+ snprintf(ssid_device_name, sizeof(ssid_device_name), "%s", device->name);
+ THINGS_LOG_V(THINGS_INFO, TAG, "DeviceName : %s", ssid_device_name);
wifi_manager_info_s st_wifi_info;
wifi_manager_get_info(&st_wifi_info);
snprintf(mac_id, sizeof(mac_id), "%02X%02X", st_wifi_info.mac_address[4], st_wifi_info.mac_address[5]);
- snprintf(g_easysetup_softap_ssid, sizeof(g_easysetup_softap_ssid), "%s_%s%s%s%d%s", device->name, g_easysetup_tag, g_manufacturer_name, g_setup_id, 0, mac_id);
+ snprintf(g_easysetup_softap_ssid, sizeof(g_easysetup_softap_ssid), "%s_%s%s%s%d%s", ssid_device_name, g_easysetup_tag, g_manufacturer_name, g_setup_id, 0, mac_id);
THINGS_LOG_V(THINGS_INFO, TAG, "SoftAP SSID : %s", g_easysetup_softap_ssid);
- strncpy(ap_config.ssid, g_easysetup_softap_ssid, strlen(g_easysetup_softap_ssid) + 1);
- strncpy(ap_config.passphrase, g_easysetup_softap_passphrase, strlen(g_easysetup_softap_passphrase) + 1);
+ snprintf(ap_config.ssid, sizeof(ap_config.ssid), "%s", g_easysetup_softap_ssid);
+ snprintf(ap_config.passphrase, sizeof(ap_config.passphrase), "%s", g_easysetup_softap_passphrase);
ap_config.channel = g_easysetup_softap_channel;
return &ap_config;
