Skip to content

Commit b20e87a

Browse files
D-Trivenikartben
authored andcommitted
net: lib: wifi_credentials: Fix security type check while storing creds
Fix credential store corruption issue caused by missing security type checks. Add support for all valid security types to ensure credentials are parsed correctly. Fixes #88261. Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
1 parent 4f8572c commit b20e87a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

subsys/net/lib/wifi_credentials/wifi_credentials.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,7 @@ int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_l
132132
goto exit;
133133
}
134134

135-
if (buf->header.type != WIFI_SECURITY_TYPE_NONE &&
136-
buf->header.type != WIFI_SECURITY_TYPE_PSK &&
137-
buf->header.type != WIFI_SECURITY_TYPE_PSK_SHA256 &&
138-
buf->header.type != WIFI_SECURITY_TYPE_SAE &&
139-
buf->header.type != WIFI_SECURITY_TYPE_EAP_TLS &&
140-
buf->header.type != WIFI_SECURITY_TYPE_WPA_PSK) {
135+
if (buf->header.type < 0 || buf->header.type > WIFI_SECURITY_TYPE_MAX) {
141136
LOG_ERR("Requested WiFi credentials entry is corrupted");
142137
ret = -EPROTO;
143138
goto exit;

0 commit comments

Comments
 (0)