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

Avoid slice bounds out of range #110

Open dki1110 opened 4 years ago

dki1110 commented 4 years ago

Fixed the following panic when scaning.

panic: runtime error: slice bounds out of range [2:1]

goroutine 18803 [running]:
github.com/paypal/gatt.(*Advertisement).unmarshall(0x2711ef0, 0x2761160, 0xe, 0xe, 0x115b94, 0x2492018)
    /home/pi/.go/src/github.com/paypal/gatt/adv.go:99 +0x8c4
github.com/paypal/gatt.(*device).Init.func3(0x24599e0)
    /home/pi/.go/src/github.com/paypal/gatt/device_linux.go:97 +0x50
github.com/paypal/gatt/linux.(*HCI).handleAdvertisement(0x248e040, 0x2796b93, 0xc, 0xc)
    /home/pi/.go/src/github.com/paypal/gatt/linux/hci.go:262 +0x214
created by github.com/paypal/gatt/linux.(*HCI).handleLEMeta
    /home/pi/.go/src/github.com/paypal/gatt/linux/hci.go:359 +0x114