mirror of
https://github.com/fiatjaf/nak.git
synced 2026-07-30 19:36:15 +00:00
helpers: reject kind numbers above 65535 instead of silently truncating them to uint16.
This commit is contained in:
@@ -627,6 +627,9 @@ func getSchema() (schema.Schema, error) {
|
||||
|
||||
func stringToKind(value string) (nostr.Kind, error) {
|
||||
if n, err := strconv.Atoi(value); err == nil && n >= 0 {
|
||||
if n > 65535 {
|
||||
return 0, fmt.Errorf("kind number %d is out of range (0-65535)", n)
|
||||
}
|
||||
return nostr.Kind(n), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user