mirror of https://github.com/pkg/sftp.git
client fix potential crash if we receive a short packet
This commit is contained in:
parent
5b7da38a9c
commit
23462f6cd7
|
@ -273,7 +273,10 @@ func (c *Client) recvVersion() error {
|
|||
return &unexpectedPacketErr{sshFxpVersion, typ}
|
||||
}
|
||||
|
||||
version, data := unmarshalUint32(data)
|
||||
version, data, err := unmarshalUint32Safe(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if version != sftpProtocolVersion {
|
||||
return &unexpectedVersionErr{sftpProtocolVersion, version}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue