mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
agnhost/netexec: handle nil pointer dereference for SCTP server
If the client immediately closes connection after SCTP handshake, the remote-addr fetched by SCTP server can be nil, causing the server to crash. Signed-off-by: Daman Arora <aroradaman@gmail.com>
This commit is contained in:
parent
8946348636
commit
8cf4567f3c
@ -693,7 +693,11 @@ func startSCTPServer(sctpPort int) {
|
||||
for {
|
||||
conn, err := listener.AcceptSCTP()
|
||||
assertNoError(err, fmt.Sprintf("failed accepting SCTP connections"))
|
||||
clientAddress := conn.RemoteAddr().String()
|
||||
remoteAddr, err := conn.SCTPRemoteAddr(0)
|
||||
if err != nil {
|
||||
assertNoError(err, "failed to get SCTP client remote address")
|
||||
}
|
||||
clientAddress := remoteAddr.String()
|
||||
n, err := conn.Read(buf)
|
||||
assertNoError(err, fmt.Sprintf("failed to read from SCTP client %s", clientAddress))
|
||||
receivedText := strings.ToLower(strings.TrimSpace(string(buf[0:n])))
|
||||
|
Loading…
Reference in New Issue
Block a user