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
1 changed files with 2 additions and 2 deletions

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;