Skip to content

Commit 1898273

Browse files
ecsvgregkh
authored andcommitted
batman-adv: tt: prevent TVLV OOB check overflow
commit 7a581d9 upstream. A TT unicast TVLV contains the number of VLANs stored in it. This number is an u16 and gets multiplied by the size of the struct batadv_tvlv_tt_vlan_data (8 bytes). The size can therefore overflow the u16 used to store the tt_vlan_len. All additional safety checks to prevent out-of-bounds access of the TVLV buffer are invalid due to this overflow. Using size_t prevents this overflow and ensures that the safety checks compare against the actual buffer requirements. Cc: stable@vger.kernel.org Fixes: 7ea7b4a ("batman-adv: make the TT CRC logic VLAN specific") Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4f3bf29 commit 1898273

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/batman-adv/translation-table.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4101,7 +4101,8 @@ static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
41014101
u16 tvlv_value_len)
41024102
{
41034103
struct batadv_tvlv_tt_data *tt_data;
4104-
u16 tt_vlan_len, tt_num_entries;
4104+
u16 tt_num_entries;
4105+
size_t tt_vlan_len;
41054106
char tt_flag;
41064107
bool ret;
41074108

0 commit comments

Comments
 (0)