mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-02 12:30:17 +02:00
nip19: guard against broken TLVs.
fixes https://github.com/nbd-wtf/go-nostr/issues/161
This commit is contained in:
@@ -18,6 +18,10 @@ func readTLVEntry(data []byte) (typ uint8, value []byte) {
|
||||
|
||||
typ = data[0]
|
||||
length := int(data[1])
|
||||
if len(data) < 2+length {
|
||||
return typ, nil
|
||||
}
|
||||
|
||||
value = data[2 : 2+length]
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user