Commit 3aa0c867 authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Benjamin Cabé
Browse files

net: wifi_cred: Check null before access



We must do null check before trying to access the fields.

Fixes #81980
Coverify-CID: 434549

Signed-off-by: default avatarJukka Rissanen <jukka.rissanen@nordicsemi.no>
parent b4fb833e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -154,13 +154,13 @@ int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal
{
	int ret;

	if (creds->header.ssid_len > WIFI_SSID_MAX_LEN || creds->header.ssid_len == 0) {
		LOG_ERR("Cannot set WiFi credentials, SSID has invalid format");
	if (creds == NULL) {
		LOG_ERR("Cannot set WiFi credentials, provided struct pointer cannot be NULL");
		return -EINVAL;
	}

	if (creds == NULL) {
		LOG_ERR("Cannot set WiFi credentials, provided struct pointer cannot be NULL");
	if (creds->header.ssid_len > WIFI_SSID_MAX_LEN || creds->header.ssid_len == 0) {
		LOG_ERR("Cannot set WiFi credentials, SSID has invalid format");
		return -EINVAL;
	}