AX.25: Prevent integer overflows in connect and sendmsg
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 23 Jul 2020 14:49:57 +0000 (17:49 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Jul 2020 14:44:06 +0000 (16:44 +0200)
commit15a9765cf8dd9373913af7663fd51df6e7151d5e
treed6dff959648e6525bf70e3153be573636ad3724f
parent3a74e2808eba19e42249f183e6a12450d3f00d54
AX.25: Prevent integer overflows in connect and sendmsg

[ Upstream commit 17ad73e941b71f3bec7523ea4e9cbc3752461c2d ]

We recently added some bounds checking in ax25_connect() and
ax25_sendmsg() and we so we removed the AX25_MAX_DIGIS checks because
they were no longer required.

Unfortunately, I believe they are required to prevent integer overflows
so I have added them back.

Fixes: 8885bb0621f0 ("AX.25: Prevent out-of-bounds read in ax25_sendmsg()")
Fixes: 2f2a7ffad5c6 ("AX.25: Fix out-of-bounds read in ax25_connect()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ax25/af_ax25.c