mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-26 12:26:11 +00:00
staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()
commit5f1c7031e0
upstream. The "exc->key_len" is a u16 that comes from the user. If it's over IW_ENCODING_TOKEN_MAX (64) that could lead to memory corruption. Fixes:b121d84882
("staging: ks7010: simplify calls to memcpy()") Cc: stable <stable@kernel.org> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/tencent_5153B668C0283CAA15AA518325346E026A09@qq.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
57678f5256
commit
9496fb96dd
1 changed files with 4 additions and 2 deletions
|
@ -1787,8 +1787,10 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
|
|||
commit |= SME_WEP_FLAG;
|
||||
}
|
||||
if (enc->key_len) {
|
||||
memcpy(&key->key_val[0], &enc->key[0], enc->key_len);
|
||||
key->key_len = enc->key_len;
|
||||
int key_len = clamp_val(enc->key_len, 0, IW_ENCODING_TOKEN_MAX);
|
||||
|
||||
memcpy(&key->key_val[0], &enc->key[0], key_len);
|
||||
key->key_len = key_len;
|
||||
commit |= (SME_WEP_VAL1 << index);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue