You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I execute the code, it stuck in an endless loop.
func TestNewPacket(t *testing.T) {
p := adv.NewRawPacket([]byte{0xff, 0x7f, 0xff, 0xff})
p.ManufacturerData() // <- stuck here
}
Right now this happens, because
func (p *Packet) Field(typ byte) []byte {
b := p.b
for len(b) > 0 {
if len(b) < 2 {
return nil
}
l, t := b[0], b[1]
if int(l) < 1 || len(b) < int(1+l) { // if l is 255, then uint8 255 + 1 will result in 0
return nil
}
if t == typ {
return b[2 : 2+l-1]
}
b = b[1+l:] // the same goes here. Since the sum is 0, it will take the whole package again
}
return nil
}
The text was updated successfully, but these errors were encountered:
If I execute the code, it stuck in an endless loop.
Right now this happens, because
The text was updated successfully, but these errors were encountered: