Skip to content

Commit

Permalink
Fix infinite loop
Browse files Browse the repository at this point in the history
'ret' could be set to non-zero inside the loop and the 'cmac->bufferSz' never gets reset causing 'add' to become 0 in the subsequent loop.
  • Loading branch information
Andras Fekete committed May 8, 2024
1 parent d22991b commit 8f9c8a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wolfcrypt/src/cmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int wc_CmacUpdate(Cmac* cmac, const byte* in, word32 inSz)
/* Clear CRYPTOCB_UNAVAILABLE return code */
ret = 0;

while (inSz != 0) {
while ((ret == 0) && (inSz != 0)) {
word32 add = min(inSz, AES_BLOCK_SIZE - cmac->bufferSz);
XMEMCPY(&cmac->buffer[cmac->bufferSz], in, add);

Expand Down

0 comments on commit 8f9c8a1

Please sign in to comment.