Merge pull request #3726 from nspcc-dev/fix-unexpected-empty-payload

network: fix "unexpected empty payload: CMDVersion"
This commit is contained in:
Anna Shaleva 2024-12-05 23:34:05 +03:00 committed by GitHub
commit 49267f3412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,6 +99,9 @@ func (m *Message) Decode(br *io.BinReader) error {
m.Flags = MessageFlag(br.ReadB())
m.Command = CommandType(br.ReadB())
l := br.ReadVarUint()
if br.Err != nil {
return br.Err
}
// check the length first in order not to allocate memory
// for an empty compressed payload
if l == 0 {