Skip to content

Commit

Permalink
client fix potential crash if we receive a short packet
Browse files Browse the repository at this point in the history
  • Loading branch information
drakkan committed Mar 10, 2021
1 parent 5b7da38 commit 23462f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand Down

0 comments on commit 23462f6

Please sign in to comment.