paypal / gatt

Gatt is a Go package for building Bluetooth Low Energy peripherals
BSD 3-Clause "New" or "Revised" License
1.12k stars 283 forks source link

LEAdvertisingReportEP.Unmarshal panics for bad length packets #78

Open thomasf opened 8 years ago

thomasf commented 8 years ago

This has paniced for me a few times, seems like something might be sending bad data (?).

That function could probably benefit from some additional length checks in general if it isn't done somewhere else.

panic(0x5a0b08, 0x10d0a018)
    /home/thomasf/.opt/go/src/runtime/panic.go:481 +0x330
.../vendor/github.com/currantlabs/gatt/linux/evt.(*LEAdvertisingReportEP).Unmarshal(0x12416f80, 0x1312500e, 0x1, 0xff2, 0x0, 0x0)
    .../vendor/github.com/currantlabs/gatt/linux/evt/evt.go:327 +0xb5c
.../vendor/github.com/currantlabs/gatt/linux.(*HCI).handleAdvertisement(0x114a4050, 0x13125003, 0xc, 0xffd)
    .../vendor/github.com/currantlabs/gatt/linux/hci.go:259 +0x78
created by .../vendor/github.com/currantlabs/gatt/linux.(*HCI).handleLEMeta
    .../vendor/github.com/currantlabs/gatt/linux/hci.go:371 +0xc4