mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
network: enforce max EAP/pkey password length
This commit is contained in:
parent
d40a8d1a6d
commit
ca9110e8c2
@ -892,7 +892,15 @@ static void eap_password_callback(enum agent_result result, const char *value,
|
||||
struct eap_secret_request *req = user_data;
|
||||
|
||||
req->network->agent_request = 0;
|
||||
|
||||
if (value) {
|
||||
if (strlen(value) < IWD_MAX_PASSWORD_LEN)
|
||||
req->secret->value = l_strdup(value);
|
||||
else {
|
||||
l_error("EAP password too long");
|
||||
result = AGENT_RESULT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
req->callback(result, message, req);
|
||||
}
|
||||
@ -910,11 +918,18 @@ static void eap_user_password_callback(enum agent_result result,
|
||||
size_t len1 = strlen(user) + 1;
|
||||
size_t len2 = strlen(passwd) + 1;
|
||||
|
||||
if (len2 > IWD_MAX_PASSWORD_LEN) {
|
||||
l_error("EAP password too long");
|
||||
result = AGENT_RESULT_FAILED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
req->secret->value = l_malloc(len1 + len2);
|
||||
memcpy(req->secret->value, user, len1);
|
||||
memcpy(req->secret->value + len1, passwd, len2);
|
||||
}
|
||||
|
||||
done:
|
||||
req->callback(result, message, req);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user