Bugfix index out of bounds (\r\n\r\n split over two packets) (#632)

This commit is contained in:
bruce34
2019-02-16 09:03:17 +01:00
committed by Leonid Bugaev
parent ec3f104c8c
commit 476ed808f9
+3 -2
View File
@@ -220,8 +220,9 @@ func (t *TCPMessage) updateHeadersPacket() {
t.headerPacket = i
return
}
} else if bytes.Equal(p.Data, bBR) {
if bytes.LastIndex(t.packets[i-1].Data, bBR) != -1 {
} else if i > 0 && bytes.Equal(p.Data, bBR) {
idx := bytes.LastIndex(t.packets[i-1].Data, bBR)
if idx != -1 && idx == len(t.packets[i-1].Data)-len(bBR) {
t.headerPacket = i
return
}