5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 01:21:37 +00:00

Set max metadata size to 16kb

This commit is contained in:
Neil Alexander 2018-12-15 13:18:35 +00:00
parent 07c26176b6
commit 226c72df16
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -104,6 +104,9 @@ func (m *metadata) setMetadata(given interface{}) error {
} }
} }
if newjson, err := json.Marshal(newmeta); err == nil { if newjson, err := json.Marshal(newmeta); err == nil {
if len(newjson) > 16384 {
return errors.New("Metadata exceeds max length of 16384 bytes")
}
m.myMetadata = newjson m.myMetadata = newjson
return nil return nil
} else { } else {