1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

lib:crypto: Check for overflow before filling pauth_tag array

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2022-08-02 14:34:26 +12:00 committed by Andrew Bartlett
parent 03f0e4d55b
commit cec59b82f7

View File

@ -124,6 +124,14 @@ samba_gnutls_aead_aes_256_cbc_hmac_sha512_encrypt(TALLOC_CTX *mem_ctx,
* TODO: Use gnutls_cipher_encrypt3()
*/
if (hmac_size > 64) {
/*
* We don't want to overflow 'pauth_tag', which is 64 bytes in
* size.
*/
return NT_STATUS_INVALID_BUFFER_SIZE;
}
if (plaintext->length + aes_block_size < plaintext->length) {
return NT_STATUS_INVALID_BUFFER_SIZE;
}