go.crypto/ssh: never send more data than maxpacket
RFC 4254 s5.2 is clear that a client must never send a data packet larger than the value of maximum packet supplied by the remote side during channel setup. The client was not honoring this value, in fact it wasn't even recording it. Thanks to Albert Strasheim for the bug report. R=agl, fullung CC=golang-dev https://golang.org/cl/6448128
This commit is contained in:
+8
-7
@@ -569,14 +569,15 @@ func (s *ServerConn) Accept() (Channel, error) {
|
||||
conn: s,
|
||||
remoteId: msg.PeersId,
|
||||
remoteWin: window{Cond: newCond()},
|
||||
// TODO(dfc) assert this param is < 2^31.
|
||||
maxPacketSize: msg.MaxPacketSize,
|
||||
},
|
||||
chanType: msg.ChanType,
|
||||
maxPacketSize: msg.MaxPacketSize,
|
||||
extraData: msg.TypeSpecificData,
|
||||
myWindow: defaultWindowSize,
|
||||
serverConn: s,
|
||||
cond: newCond(),
|
||||
pendingData: make([]byte, defaultWindowSize),
|
||||
chanType: msg.ChanType,
|
||||
extraData: msg.TypeSpecificData,
|
||||
myWindow: defaultWindowSize,
|
||||
serverConn: s,
|
||||
cond: newCond(),
|
||||
pendingData: make([]byte, defaultWindowSize),
|
||||
}
|
||||
c.remoteWin.add(msg.PeersWindow)
|
||||
s.lock.Lock()
|
||||
|
||||
Reference in New Issue
Block a user