mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 21:32:56 +01:00
handle invalid subscription id from relay on subIdToSerial().
This commit is contained in:
parent
ad14daec9f
commit
05eb11e302
@ -96,6 +96,10 @@ func arePointerValuesEqual[V comparable](a *V, b *V) bool {
|
||||
}
|
||||
|
||||
func subIdToSerial(subId string) int64 {
|
||||
serialId, _ := strconv.ParseInt(subId[0:strings.Index(subId, ":")], 10, 64)
|
||||
n := strings.Index(subId, ":")
|
||||
if n < 0 || n > len(subId) {
|
||||
return -1
|
||||
}
|
||||
serialId, _ := strconv.ParseInt(subId[0:n], 10, 64)
|
||||
return serialId
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user