Skip to content

Commit 842169b

Browse files
committed
fix scan-build warnings
1 parent 3c42b6a commit 842169b

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 || headerlen > 0x7fffffffu) {
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) {
@@ -144,7 +147,7 @@ int ccm_memory(int cipher,
144147
(L-1));
145148

146149
/* nonce */
147-
for (y = 0; y < 15 - L; y++) {
150+
for (y = 0; y < noncelen; y++) {
148151
PAD[x++] = nonce[y];
149152
}
150153

0 commit comments

Comments
 (0)