mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
wl1251: Fix possible buffer overflow in wl1251_cmd_scan
[ Upstream commit d10a87a353
]
Function wl1251_cmd_scan calls memcpy without checking the length.
Harden by checking the length is within the maximum allowed size.
Signed-off-by: Lee Gibson <leegib@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210428115508.25624-1-leegib@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6bb8e97054
commit
0f6c048836
1 changed files with 6 additions and 3 deletions
|
@ -466,9 +466,12 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
|
|||
cmd->channels[i].channel = channels[i]->hw_value;
|
||||
}
|
||||
|
||||
cmd->params.ssid_len = ssid_len;
|
||||
if (ssid)
|
||||
memcpy(cmd->params.ssid, ssid, ssid_len);
|
||||
if (ssid) {
|
||||
int len = clamp_val(ssid_len, 0, IEEE80211_MAX_SSID_LEN);
|
||||
|
||||
cmd->params.ssid_len = len;
|
||||
memcpy(cmd->params.ssid, ssid, len);
|
||||
}
|
||||
|
||||
ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd));
|
||||
if (ret < 0) {
|
||||
|
|
Loading…
Reference in a new issue