Add length check to natneg handleReport

This commit is contained in:
ppeb 2025-04-28 15:15:16 -05:00
parent 3029af0ecb
commit f5ffcbccec
No known key found for this signature in database
GPG Key ID: CC147AD1B3D318D0

View File

@ -9,7 +9,12 @@ import (
"github.com/logrusorgru/aurora/v3"
)
func (session *NATNEGSession) handleReport(conn net.PacketConn, addr net.Addr, buffer []byte, _ string, version byte) {
func (session *NATNEGSession) handleReport(conn net.PacketConn, addr net.Addr, buffer []byte, _moduleName string, version byte) {
if len(buffer) < 2 {
logging.Error(_moduleName, "Invalid packet size")
return
}
response := createPacketHeader(version, NNReportReply, session.Cookie)
response = append(response, buffer[:9]...)
response[14] = 0