Skip to content

Commit c2f6c40

Browse files
committed
prevent UB
This prevents incrementing `adata`, which can be a NULL pointer at this point. Fixes #583 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 4a1477e commit c2f6c40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/encauth/gcm/gcm_add_aad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ int gcm_add_aad(gcm_state *gcm,
8383

8484
x = 0;
8585
#ifdef LTC_FAST
86-
if (gcm->buflen == 0) {
86+
if (gcm->buflen == 0 && adatalen > 15) {
8787
for (x = 0; x < (adatalen & ~15); x += 16) {
8888
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
8989
*(LTC_FAST_TYPE_PTR_CAST(&gcm->X[y])) ^= *(LTC_FAST_TYPE_PTR_CAST(&adata[x + y]));

0 commit comments

Comments
 (0)