mirror of
https://github.com/torvalds/linux.git
synced 2024-12-30 06:41:43 +00:00
ipw2x00: potential buffer overflow in libipw_wx_set_encodeext()
The "ext->key_len" is a u16 that comes from the user. If it's over
SCM_KEY_LEN (32) that could lead to memory corruption.
Fixes: e0d369d1d9
("[PATCH] ieee82011: Added WE-18 support to default wireless extension handler")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Stanislav Yakovlev <stas.yakovlev@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/YHaoA1i+8uT4ir4h@mwanda
This commit is contained in:
parent
e9642be26a
commit
260a9ad944
@ -633,8 +633,10 @@ int libipw_wx_set_encodeext(struct libipw_device *ieee,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ext->alg != IW_ENCODE_ALG_NONE) {
|
if (ext->alg != IW_ENCODE_ALG_NONE) {
|
||||||
memcpy(sec.keys[idx], ext->key, ext->key_len);
|
int key_len = clamp_val(ext->key_len, 0, SCM_KEY_LEN);
|
||||||
sec.key_sizes[idx] = ext->key_len;
|
|
||||||
|
memcpy(sec.keys[idx], ext->key, key_len);
|
||||||
|
sec.key_sizes[idx] = key_len;
|
||||||
sec.flags |= (1 << idx);
|
sec.flags |= (1 << idx);
|
||||||
if (ext->alg == IW_ENCODE_ALG_WEP) {
|
if (ext->alg == IW_ENCODE_ALG_WEP) {
|
||||||
sec.encode_alg[idx] = SEC_ALG_WEP;
|
sec.encode_alg[idx] = SEC_ALG_WEP;
|
||||||
|
Loading…
Reference in New Issue
Block a user