fix out of range index in headerIndex, github.com/buger/goreplay/issues/578

This commit is contained in:
defa sun
2018-05-23 20:33:32 +03:00
committed by Leonid Bugaev
parent 4e46bb46af
commit 7b1544157f
+5
View File
@@ -93,6 +93,11 @@ func headerIndex(payload []byte, name []byte) int {
return i - len(name)
}
// We are at the end
if i == len(payload) {
return -1
}
if payload[i] != name[j] {
break
}