I'm not too familiar with this library but I saw this question on SO, which highlight an issue in the function
func (c *Cmd) SendAndCheckResp(cp CmdParam, exp []byte) error {
rsp, err := c.Send(cp)
if err != nil {
return err
}
// Don't care about the response
if len(exp) == 0 {
return nil
}
// Check the if status is one of the expected value
if !bytes.Contains(exp, rsp[0:1]) {
return fmt.Errorf("HCI command: '0x%04x' return 0x%02X, expect: [%X] ", cp.Opcode(), rsp[0], exp)
}
return nil
}
when the rsp is empty, or have capacity zero. The problem seems to be when trying to access the first two elements on rsp on line
if !bytes.Contains(exp, rsp[0:1]) {
....
I think this issue could be avoided just checking if len(rsp) == 0, and respond appropriately, but again I'm not familiar with the library so a better solution could be suggested by another person. I just thought is worth to report the issue.
I'm not too familiar with this library but I saw this question on SO, which highlight an issue in the function
when the rsp is empty, or have capacity zero. The problem seems to be when trying to access the first two elements on rsp on line
I think this issue could be avoided just checking if
len(rsp) == 0, and respond appropriately, but again I'm not familiar with the library so a better solution could be suggested by another person. I just thought is worth to report the issue.