wapi: Verify if password size if valid

This commit is contained in:
Alan Carvalho de Assis 2022-10-10 17:23:31 -03:00 committed by Xiang Xiao
parent ab7cb90f88
commit abbe022894

View File

@ -546,9 +546,19 @@ static int wapi_psk_cmd(int sock, int argc, FAR char **argv)
{
enum wpa_alg_e alg_flag;
uint8_t auth_wpa;
int passlen;
int cipher;
int ret;
/* Check if password len >= 8 && <= 63 */
passlen = strnlen(argv[1], 64);
if (passlen < 8 || passlen > 63)
{
printf("The password should have between 8 and 63 characters!\n");
return -EINVAL;
}
/* Convert input strings to values */
alg_flag = (enum wpa_alg_e)wapi_str2ndx(argv[2], g_wapi_alg_flags);