Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36a3f052 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix potential stack overflow caused by integer overflow

Bug: 151155194
Change-Id: I0655b0b62301f78cd8705cc7b0e4fc11522f00ca
parent d9cedca0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -167,7 +167,8 @@ static void cmac_generate_subkey(const Octet16& key) {
 *  length - length of the input in byte.
 */
Octet16 aes_cmac(const Octet16& key, const uint8_t* input, uint16_t length) {
  uint16_t len, diff;
  uint32_t len;
  uint16_t diff;
  /* n is number of rounds */
  uint16_t n = (length + OCTET16_LEN - 1) / OCTET16_LEN;

+2 −1
Original line number Diff line number Diff line
@@ -180,7 +180,8 @@ static void cmac_generate_subkey(const Octet16& key) {
 *  length - length of the input in byte.
 */
Octet16 aes_cmac(const Octet16& key, const uint8_t* input, uint16_t length) {
  uint16_t len, diff;
  uint32_t len;
  uint16_t diff;
  /* n is number of rounds */
  uint16_t n = (length + OCTET16_LEN - 1) / OCTET16_LEN;