commit a983ca0c3306e16502ccea0742ee4119fd93ef36
parent 06ee531749695dcad71c60094ab110c9addd1d25
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Mon, 18 Mar 2019 16:59:37 -0700
eap-pwd: fix buffer overflow for larger groups
The KDF function processes data in 32 byte chunks so for groups which
primes are not divisible by 32 bytes, you will get a buffer overflow
when copying the last chunk of data.
Now l_checksum_get_digest is limited to the bytes remaining in the
buffer, or 32, whichever is the smallest.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/eap-pwd.c b/src/eap-pwd.c
@@ -117,7 +117,7 @@ static bool kdf(uint8_t *key, size_t key_len, const char *label,
if (!l_checksum_updatev(hmac, iov, iov_pos))
return false;
- l_checksum_get_digest(hmac, out + len, 32);
+ l_checksum_get_digest(hmac, out + len, minsize(olen - len, 32));
l_checksum_free(hmac);
len += 32;