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: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
b4fb833eb9
commit
3aa0c8670e
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue