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 Oct 12, 2021
1 parent 00fe9ca commit c9a9ac1
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 @@ -550,6 +550,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 c9a9ac1

Please sign in to comment.