We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dc98e52 commit b837181Copy full SHA for b837181
1 file changed
hci.go
@@ -197,6 +197,12 @@ func (h *hci) poll() error {
197
// perform read only if more data is available
198
available := h.transport.Buffered()
199
if available > 0 {
200
+ // limit to buffer size
201
+ if available > len(h.buf)-h.end {
202
+ available = len(h.buf) - h.end
203
+ }
204
+
205
+ // read in 4 byte aligned chunks
206
aligned := available + (4-(available%4))%4
207
n, err := h.transport.Read(h.buf[h.end : h.end+aligned])
208
if err != nil {
0 commit comments