Fix panic on invalid handshake length

This commit is contained in:
Neil Alexander 2023-10-12 19:12:17 +01:00
parent 4b48fd0b5f
commit 117e4b88f8
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -101,6 +101,9 @@ func (m *version_metadata) decode(r io.Reader, password []byte) bool {
return false return false
} }
if len(bs) < ed25519.SignatureSize {
return false
}
sig := bs[len(bs)-ed25519.SignatureSize:] sig := bs[len(bs)-ed25519.SignatureSize:]
bs = bs[:len(bs)-ed25519.SignatureSize] bs = bs[:len(bs)-ed25519.SignatureSize]