Fix compiler warning

```
src/encauth/ccm/ccm_memory.c: In function ‘ccm_memory’:
src/encauth/ccm/ccm_memory.c:164:17: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  164 |        PAD[x++] = (unsigned char)((len >> 24) & 255);
      |        ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/encauth/ccm/ccm_memory.c:43:19: note: at offset 16 into destination object ‘PAD’ of size 16
   43 |    unsigned char  PAD[16], ctr[16], CTRPAD[16], ptTag[16], b, *pt_real;
      |                   ^~~
```

Multiple reviews and tests determined that this can't happen, but most
likely computers are better in finding out such stuff (or it was a false
positive).

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel 2023-10-05 10:42:18 +02:00 committed by Jamie Reece Wilson
parent e83b9ced72
commit 74ddf11d55

View File

@ -161,6 +161,9 @@ int ccm_memory(int cipher,
PAD[x++] = 0;
}
for (; y < L; y++) {
if (x >= sizeof(PAD)) {
return CRYPT_INVALID_ARG;
}
PAD[x++] = (unsigned char)((len >> 24) & 255);
len <<= 8;
}