Skip to content

Commit 349d56e

Browse files
committed
Fix compiler warning
Repeated from 97edea3 ``` src/encauth/ccm/ccm_add_nonce.c: In function ‘ccm_add_nonce’: src/encauth/ccm/ccm_add_nonce.c:61:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 61 | ccm->PAD[x++] = (unsigned char)((len >> 24) & 255); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ./src/headers/tomcrypt.h:82, from ./src/headers/tomcrypt_private.h:4, from src/encauth/ccm/ccm_add_nonce.c:3: ./src/headers/tomcrypt_mac.h:410:24: note: at offset 16 into destination object ‘PAD’ of size 16 410 | unsigned char PAD[16], /* flags | Nonce N | l(m) */ ``` Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent c4b423f commit 349d56e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/encauth/ccm/ccm_add_nonce.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ int ccm_add_nonce(ccm_state *ccm,
5858
ccm->PAD[x++] = 0;
5959
}
6060
for (; y < ccm->L; y++) {
61+
if (x >= sizeof(ccm->PAD)) {
62+
return CRYPT_INVALID_ARG;
63+
}
6164
ccm->PAD[x++] = (unsigned char)((len >> 24) & 255);
6265
len <<= 8;
6366
}

0 commit comments

Comments
 (0)