dot11decrypt: explicitly cast *pmk_len and msk_len

In a typical setting where int is 32 bits and the type guint8 is 8 bits,
the overflow check in Dot11DecryptDerivePmkFromMsk will automatically
promote the sum of msk_len and *pmk_len to an int. Since int is 32 bits
and guint8 will always be 8 bits, the sum will never overflow.
Therefore, an explicit casting of the sum of msk_len and *pmk_len to
the type guint8 is necessary.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
This commit is contained in:
Elijah Conners 2022-06-03 11:40:41 -07:00 committed by A Wireshark GitLab Utility
parent 8fd9d1d274
commit f72a33fc1c
1 changed files with 1 additions and 1 deletions

View File

@ -1531,7 +1531,7 @@ Dot11DecryptDerivePmkFromMsk(const guint8 *msk, guint8 msk_len, int akm,
} else {
*pmk_len = 256 / 8;
}
if (msk_len + *pmk_len < msk_len) {
if ((guint8)(msk_len + *pmk_len) < msk_len) {
*pmk_len = 0;
return;
}