Skip to content

Commit 91a0d61

Browse files
committed
fix scan-build warnings
1 parent f31c49c commit 91a0d61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/encauth/ccm/ccm_memory.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ int ccm_memory(int cipher,
7878
if (*taglen < 4 || *taglen > 16 || (*taglen % 2) == 1) {
7979
return CRYPT_INVALID_ARG;
8080
}
81+
if (noncelen < 7) {
82+
return CRYPT_INVALID_ARG;
83+
}
8184

8285
/* is there an accelerator? */
8386
if (cipher_descriptor[cipher].accel_ccm_memory != NULL) {
@@ -141,7 +144,7 @@ int ccm_memory(int cipher,
141144
(L-1));
142145

143146
/* nonce */
144-
for (y = 0; y < (16 - (L + 1)); y++) {
147+
for (y = 0; y < noncelen; y++) {
145148
PAD[x++] = nonce[y];
146149
}
147150

0 commit comments

Comments
 (0)