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

Commit a5a3bf10 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Automerger Merge Worker
Browse files

Fix potential stack overflow caused by integer overflow am: c45ee0e1 am: b8134ff3

Change-Id: Ica69b780e2221d5ce2a9b4970498ecf3095f43a9
parents a22694cc b8134ff3
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -180,7 +180,8 @@ static void cmac_generate_subkey(const Octet16& key) {
 *  length - length of the input in byte.
 *  length - length of the input in byte.
 */
 */
Octet16 aes_cmac(const Octet16& key, const uint8_t* input, uint16_t length) {
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 */
  /* n is number of rounds */
  uint16_t n = (length + OCTET16_LEN - 1) / OCTET16_LEN;
  uint16_t n = (length + OCTET16_LEN - 1) / OCTET16_LEN;