diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-10-02 11:57:31 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-10-02 11:57:49 +0200 |
commit | 24bf16fd86168b5410d8ae51c604c1bfe66f1b34 (patch) | |
tree | 93f2ec43d0a23d35ddaf7a2d711707f8ef0332fd | |
parent | e1f442f1131cbf176a0063c07afddef2bfa4aef2 (diff) | |
download | gnutls-tmp-check-iv-size.tar.gz |
encrypt_packet_tls13: added explicit check on iv_size boundstmp-check-iv-size
Although there are no ciphers defined for TLS1.3 which would overflow
the assumed bound, an explicit check is necessary to avoid that code
be a liability in future updates.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/cipher.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/cipher.c b/lib/cipher.c index 3d999de8a6..3ea1cb1bb2 100644 --- a/lib/cipher.c +++ b/lib/cipher.c @@ -448,6 +448,9 @@ encrypt_packet_tls13(gnutls_session_t session, return plain->size; } + if (unlikely(iv_size < 8)) + return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); + memcpy(nonce, params->write.iv, iv_size); memxor(&nonce[iv_size-8], UINT64DATA(params->write.sequence_number), 8); |