Mirror: https://github.com/0ranko0P/kernel_xiaomi_msm8998/
修订版 | 4dd90d14f902074f18238dc104868debbd3cd250 (tree) |
---|---|
时间 | 2020-02-15 06:30:02 |
作者 | Qing Xu <m1s5p6688@gmai...> |
Commiter | Greg Kroah-Hartman |
mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
[ Upstream commit b70261a288ea4d2f4ac7cd04be08a9f0f2de4f4d ]
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().
Signed-off-by: Qing Xu <m1s5p6688@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
@@ -2568,6 +2568,13 @@ mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, | ||
2568 | 2568 | vs_param_set->header.len = |
2569 | 2569 | cpu_to_le16((((u16) priv->vs_ie[id].ie[1]) |
2570 | 2570 | & 0x00FF) + 2); |
2571 | + if (le16_to_cpu(vs_param_set->header.len) > | |
2572 | + MWIFIEX_MAX_VSIE_LEN) { | |
2573 | + mwifiex_dbg(priv->adapter, ERROR, | |
2574 | + "Invalid param length!\n"); | |
2575 | + break; | |
2576 | + } | |
2577 | + | |
2571 | 2578 | memcpy(vs_param_set->ie, priv->vs_ie[id].ie, |
2572 | 2579 | le16_to_cpu(vs_param_set->header.len)); |
2573 | 2580 | *buffer += le16_to_cpu(vs_param_set->header.len) + |