fix: eliminate stale verdict poisoning, memory leaks, data races, and per-packet allocations in engine
This commit is contained in:
@@ -130,8 +130,8 @@ func (s *httpStream) parseResponseLine() utils.LSMAction {
|
||||
return utils.LSMActionCancel
|
||||
}
|
||||
version := fields[0]
|
||||
status, _ := strconv.Atoi(fields[1])
|
||||
if !strings.HasPrefix(version, "HTTP/") || status == 0 {
|
||||
status, err := strconv.Atoi(fields[1])
|
||||
if err != nil || !strings.HasPrefix(version, "HTTP/") || status == 0 {
|
||||
// Invalid version
|
||||
return utils.LSMActionCancel
|
||||
}
|
||||
|
||||
+4
-2
@@ -6,6 +6,8 @@ import (
|
||||
"git.difuse.io/Difuse/Mellaris/analyzer/utils"
|
||||
)
|
||||
|
||||
const maxHandshakeLen = 65536
|
||||
|
||||
var _ analyzer.TCPAnalyzer = (*TLSAnalyzer)(nil)
|
||||
|
||||
type TLSAnalyzer struct{}
|
||||
@@ -123,7 +125,7 @@ func (s *tlsStream) tlsClientHelloPreprocess() utils.LSMAction {
|
||||
}
|
||||
|
||||
s.clientHelloLen = int(header[6])<<16 | int(header[7])<<8 | int(header[8])
|
||||
if s.clientHelloLen < minDataSize {
|
||||
if s.clientHelloLen < minDataSize || s.clientHelloLen > maxHandshakeLen {
|
||||
return utils.LSMActionCancel
|
||||
}
|
||||
|
||||
@@ -167,7 +169,7 @@ func (s *tlsStream) tlsServerHelloPreprocess() utils.LSMAction {
|
||||
}
|
||||
|
||||
s.serverHelloLen = int(header[6])<<16 | int(header[7])<<8 | int(header[8])
|
||||
if s.serverHelloLen < minDataSize {
|
||||
if s.serverHelloLen < minDataSize || s.serverHelloLen > maxHandshakeLen {
|
||||
return utils.LSMActionCancel
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user