mirror of
https://github.com/fiatjaf/nak.git
synced 2026-07-29 07:47:42 +02:00
Merge pull request #173 from mattn/fix/kind-overflow
helpers: reject kind numbers above 65535
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