void _wifi_add_to_ap_list(wifi_manager_ap_h ap_h);
void _wifi_remove_from_ap_list(wifi_manager_ap_h ap_h);
bool _wifi_check_profile_name_validity(const char *profile_name);
+bool _wifi_check_essid_validity(const char *essid);
int _wifi_get_wifi_device_state(wifi_manager_device_state_e *device_state);
int _wifi_get_wifi_state(wifi_manager_connection_state_e* connection_state);
RET_ERR_IF_HANDLE_IS_NOT_VALID_OR_NOT_INITIALIZED(wifi, __NETWORK_CAPI_FUNC_EXIT__);
- if (essid == NULL || ap == NULL) {
+ if (!_wifi_check_essid_validity(essid) || ap == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
__NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
RET_ERR_IF_HANDLE_IS_NOT_VALID_OR_NOT_INITIALIZED(wifi, __NETWORK_CAPI_FUNC_EXIT__);
+ if (!_wifi_check_essid_validity(name)) {
+ __NETWORK_CAPI_FUNC_EXIT__;
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
h = g_new0(wifi_config_s, 1);
if (h == NULL) {
__NETWORK_CAPI_FUNC_EXIT__;
return true;
}
+bool _wifi_check_essid_validity(const char *essid)
+{
+ int essid_len = 0;
+
+ if (essid == NULL)
+ return false;
+
+ essid_len = strlen(essid);
+
+ if (essid_len < 1 || essid_len > 32)
+ return false;
+
+ if (!g_utf8_validate(essid, -1, NULL))
+ return false;
+
+ return true;
+}
+
int _wifi_get_wifi_device_state(wifi_manager_device_state_e *device_state)
{
net_tech_info_s tech_info;
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_wifi_check_multi_scan_validity(specific_scan)) ||
- essid == NULL) {
+ !(_wifi_check_essid_validity(essid))) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
__NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE