summaryrefslogtreecommitdiffstats
path: root/providers/implementations/ciphers
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-11-25 13:13:24 +0000
committerMatt Caswell <matt@openssl.org>2020-11-30 10:37:14 +0000
commita07dc8167ba79efe739fef18d7e2ef823bef16c9 (patch)
tree5c25d9ab7f0eff4bf3d7f63e092790095e76eead /providers/implementations/ciphers
parent5658470ce7b4fabfd1fa2cdc69bee8d3a5e826f9 (diff)
Fix instances of pointer addition with the NULL pointer
Addition using the NULL pointer (even when adding 0) is undefined behaviour. Recent versions of ubsan are now complaining about this, so we fix various instances. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13513)
Diffstat (limited to 'providers/implementations/ciphers')
-rw-r--r--providers/implementations/ciphers/cipher_aes_ocb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/providers/implementations/ciphers/cipher_aes_ocb.c b/providers/implementations/ciphers/cipher_aes_ocb.c
index 7cb3f6a764..fa2c014a01 100644
--- a/providers/implementations/ciphers/cipher_aes_ocb.c
+++ b/providers/implementations/ciphers/cipher_aes_ocb.c
@@ -177,7 +177,8 @@ static int aes_ocb_block_update_internal(PROV_AES_OCB_CTX *ctx,
}
*bufsz = 0;
outlint = AES_BLOCK_SIZE;
- out += AES_BLOCK_SIZE;
+ if (out != NULL)
+ out += AES_BLOCK_SIZE;
}
if (nextblocks > 0) {
outlint += nextblocks;