Skip to content

Commit 265ac26

Browse files
herbertxgregkh
authored andcommitted
crypto: af_alg - Cap AEAD AD length to 0x80000000
commit e4c0647 upstream. In order to prevent arithmetic overflows when checking the TX buffer size, cap the associated data length to 0x80000000. Reported-by: Yiming Qian <yimingqian591@gmail.com> Fixes: 400c40c ("crypto: algif - add AEAD support") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e23a328 commit 265ac26

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

crypto/af_alg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,8 @@ static int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con)
586586
if (cmsg->cmsg_len < CMSG_LEN(sizeof(u32)))
587587
return -EINVAL;
588588
con->aead_assoclen = *(u32 *)CMSG_DATA(cmsg);
589+
if (con->aead_assoclen >= 0x80000000u)
590+
return -EINVAL;
589591
break;
590592

591593
default:

0 commit comments

Comments
 (0)