Skip to content

Commit

Permalink
Fix possible http module panic
Browse files Browse the repository at this point in the history
  • Loading branch information
vl4deee11 authored and constantinsander committed Sep 7, 2023
1 parent b457b28 commit 88e153f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/http/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ func (scan *scan) Grab() *zgrab2.ScanError {
if readLen < sliceLen {
sliceLen = readLen
}

bodyTextLen := int64(len(bodyText))
if bodyTextLen < sliceLen {
sliceLen = bodyTextLen
}

sliceBuf := bodyText[:sliceLen]
if strings.Contains(sliceBuf, "The plain HTTP request was sent to HTTPS port") ||
strings.Contains(sliceBuf, "You're speaking plain HTTP") ||
Expand Down

0 comments on commit 88e153f

Please sign in to comment.