mwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies()
authorTakashi Iwai <tiwai@suse.de>
Fri, 31 May 2019 13:18:41 +0000 (15:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Jul 2019 07:05:59 +0000 (09:05 +0200)
commitf70d411e2ecd1f8297e1fd7e91108ca220986784
tree5e3270b79f2556535ea0a36b57e968bd55024391
parent21a88663a65665b28d8e9d4e83bbf9af7a0ff89b
mwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies()

commit 69ae4f6aac1578575126319d3f55550e7e440449 upstream.

A few places in mwifiex_uap_parse_tail_ies() perform memcpy()
unconditionally, which may lead to either buffer overflow or read over
boundary.

This patch addresses the issues by checking the read size and the
destination size at each place more properly.  Along with the fixes,
the patch cleans up the code slightly by introducing a temporary
variable for the token size, and unifies the error path with the
standard goto statement.

Reported-by: huangwen <huangwen@venustech.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/marvell/mwifiex/ie.c