payload: fix wrong useragent parsing in version
C# code reads is as a proper variable-length string, so it's not limited to 252 bytes.
This commit is contained in:
parent
7b46f9bb86
commit
4f23117d32
1 changed files with 2 additions and 7 deletions
|
@ -60,11 +60,7 @@ func (p *Version) DecodeBinary(r io.Reader) error {
|
|||
br.ReadLE(&p.Timestamp)
|
||||
br.ReadLE(&p.Port)
|
||||
br.ReadLE(&p.Nonce)
|
||||
|
||||
var lenUA uint8
|
||||
br.ReadLE(&lenUA)
|
||||
p.UserAgent = make([]byte, lenUA)
|
||||
br.ReadLE(&p.UserAgent)
|
||||
p.UserAgent = br.ReadBytes()
|
||||
br.ReadLE(&p.StartHeight)
|
||||
br.ReadLE(&p.Relay)
|
||||
return br.Err
|
||||
|
@ -79,8 +75,7 @@ func (p *Version) EncodeBinary(w io.Writer) error {
|
|||
br.WriteLE(p.Port)
|
||||
br.WriteLE(p.Nonce)
|
||||
|
||||
br.WriteLE(uint8(len(p.UserAgent)))
|
||||
br.WriteLE(p.UserAgent)
|
||||
br.WriteBytes(p.UserAgent)
|
||||
br.WriteLE(p.StartHeight)
|
||||
br.WriteLE(&p.Relay)
|
||||
return br.Err
|
||||
|
|
Loading…
Reference in a new issue