mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
fix: checking boundaries when parsing WPS vendor extensions (fixes #885)
This commit is contained in:
parent
4690a23ace
commit
6c2c0da22c
1 changed files with 14 additions and 6 deletions
|
@ -177,14 +177,22 @@ func dot11ParseWPSVendorExtension(data []byte, info *map[string]string) string {
|
||||||
size := len(data)
|
size := len(data)
|
||||||
for offset := 3; offset < size; {
|
for offset := 3; offset < size; {
|
||||||
idByte := uint8(data[offset])
|
idByte := uint8(data[offset])
|
||||||
sizeByte := uint8(data[offset+1])
|
if next := offset + 1; next < size {
|
||||||
if idByte == wpsVersion2ID {
|
sizeByte := uint8(data[next])
|
||||||
verByte := fmt.Sprintf("%x", data[offset+2])
|
if idByte == wpsVersion2ID {
|
||||||
(*info)["Version"] = wpsVersionDesc[verByte]
|
if next = offset + 2; next < size {
|
||||||
data = data[offset+3:]
|
verByte := fmt.Sprintf("%x", data[next])
|
||||||
|
(*info)["Version"] = wpsVersionDesc[verByte]
|
||||||
|
if next = offset + 3; next < size {
|
||||||
|
data = data[next:]
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
offset += int(sizeByte) + 2
|
||||||
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
offset += int(sizeByte) + 2
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hex.EncodeToString(data)
|
return hex.EncodeToString(data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue