3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 04:32:37 +01:00

wscutil: Avoid potential overflow

When checking that the length is valid, avoid potentially overflowing
'start + len'
This commit is contained in:
Denis Kenzior 2022-01-14 09:45:49 -06:00
parent 22faf3482c
commit 5e9178b9de

View File

@ -61,7 +61,7 @@ bool wsc_wfa_ext_iter_next(struct wsc_wfa_ext_iter *iter)
len = *start;
start += 1;
if (start + len > end)
if (len > end - start)
return false;
iter->type = type;
@ -98,7 +98,7 @@ bool wsc_attr_iter_next(struct wsc_attr_iter *iter)
len = l_get_be16(start);
start += 2;
if (start + len > end)
if (len > end - start)
return false;
iter->type = type;