From ffebe864a42e8f0787ca9289d527f03bf58c204a Mon Sep 17 00:00:00 2001 From: dki1110 Date: Sun, 17 May 2020 14:36:07 +0900 Subject: [PATCH] Avoid slice bounds out of range --- adv.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adv.go b/adv.go index 787ff33..d62eb73 100644 --- a/adv.go +++ b/adv.go @@ -96,6 +96,9 @@ func (a *Advertisement) unmarshall(b []byte) error { if len(b) < int(1+l) { return errors.New("invalid advertise data") } + if l <= 2 { + return errors.New("invalid advertise data (l<=2)") + } d := b[2 : 1+l] switch t { case typeFlags: