3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-04-20 11:27:51 +02:00

storage: add length check in __storage_decrypt

The length of EncryptedSecurity was assumed to be at least 16 bytes
and anything less would underflow the length to l_malloc.

Fixes: 01cd8587606b ("storage: implement network profile encryption")
This commit is contained in:
James Prestwood 2025-04-16 10:33:42 -07:00 committed by Denis Kenzior
parent 8dff156eb6
commit d927fd07c1

View File

@ -500,6 +500,13 @@ int __storage_decrypt(struct l_settings *settings, const char *ssid,
return 0;
}
/*
* It should likely be far larger than this, but that will get caught
* later when reloading the decrypted data.
*/
if (elen < 16)
return -EBADMSG;
/*
* AES-SIV automatically verifies the IV (16 bytes) and returns only
* the decrypted data portion. We add one here for the NULL terminator