Fix two possible Buffer overflow in mwifiex
cover Fix two possible Buffer overflow in mwifiex
From: Qing Xu <[email protected]>
Hi,
this is fixes for a few spots that perform memcpy() without checking the source and the destination size in mwifiex driver, which may lead to buffer overflows or read over boundary.
Qing Xu
===
Qing Xu (2):
mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
mwifiex: Fix possible buffer overflows in
mwifiex_cmd_append_vsie_tlv()
drivers/net/wireless/marvell/mwifiex/scan.c | 7 +++++++ drivers/net/wireless/marvell/mwifiex/wmm.c | 4 ++++ 2 files changed, 11 insertions(+)
Signature · 1 line
2.17.1
PATCH 1/2 mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
From: Qing Xu <[email protected]>
mwifiex_ret_wmm_get_status() calls memcpy() without checking the destination size.Since the source is given from remote AP which contains illegal wmm elements , this may trigger a heap buffer overflow.
Fix it by putting the length check before calling memcpy().
--- drivers/net/wireless/marvell/mwifiex/wmm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/marvell/mwifiex/wmm.c +4 -0
@@ -970,6 +970,10 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,"WMM Parameter Set Count: %d\n" , wmm_param_ie->qos_info_bitmap & mask); +if (wmm_param_ie->vend_hdr.len +2 > +sizeof (struct ieee_types_wmm_parameter )) +break ; +memcpy ((u8 *) &priv->curr_bss_params.bss_descriptor. wmm_ie, wmm_param_ie, wmm_param_ie->vend_hdr.len +2 );
Signature · 1 line
2.17.1
Re: [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
Quoted 9 lines · [email protected] wrote:
From: Qing Xu <[email protected]>
mwifiex_ret_wmm_get_status()callsmemcpy()without checking the destination size.Since the source is given from remote AP which contains illegal wmm elements , this may trigger a heap buffer overflow.
Fix it by putting the length check before callingmemcpy().Signed-off-by Qing Xu <[email protected]>
2 patches applied to wireless-drivers.git, thanks.
3a9b153c5591 mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() b70261a288ea mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
Signature · 3 lines
https://patchwork.kernel.org/patch/11315253/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 2/2 mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
In reply to [email protected]From: Qing Xu <[email protected]>
mwifiex_cmd_append_vsie_tlv() calls memcpy() without checking the destination size may trigger a buffer overflower, which a local user could use to cause denial of service or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().
--- drivers/net/wireless/marvell/mwifiex/scan.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/marvell/mwifiex/scan.c +7 -0
@@ -2884,6 +2884,13 @@ mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, vs_param_set->header.len =cpu_to_le16 ((((u16 ) priv->vs_ie[id].ie[1 ]) &0x00FF ) +2 ); +if (le16_to_cpu (vs_param_set->header.len) > +MWIFIEX_MAX_VSIE_LEN ) { +mwifiex_dbg (priv->adapter,ERROR , +"Invalid param length!\n" ); +break ; + } +memcpy (vs_param_set->ie, priv->vs_ie[id].ie,le16_to_cpu (vs_param_set->header.len)); *buffer += le16_to_cpu(vs_param_set->header.len) +
Signature · 1 line
2.17.1