helpers: reject kind numbers above 65535 instead of silently truncating them to uint16.

This commit is contained in:
Yasuhiro Matsumoto
2026-07-15 15:34:29 +09:00
parent f96b9d458e
commit 6bd793bea5
+3
View File
@@ -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
}