forked from TrueCloudLab/neoneo-go
payload: limit the user agent field in version payload
Protocol limit.
This commit is contained in:
parent
705941a800
commit
f318e573d4
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,9 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/network/capability"
|
||||
)
|
||||
|
||||
// MaxUserAgentLength is the limit for user agent field.
|
||||
const MaxUserAgentLength = 1024
|
||||
|
||||
// Version payload.
|
||||
type Version struct {
|
||||
// NetMode of the node
|
||||
|
@ -42,7 +45,7 @@ func (p *Version) DecodeBinary(br *io.BinReader) {
|
|||
p.Version = br.ReadU32LE()
|
||||
p.Timestamp = br.ReadU32LE()
|
||||
p.Nonce = br.ReadU32LE()
|
||||
p.UserAgent = br.ReadVarBytes()
|
||||
p.UserAgent = br.ReadVarBytes(MaxUserAgentLength)
|
||||
p.Capabilities.DecodeBinary(br)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue