mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-17 13:22:56 +01:00
nip19: guard against broken TLVs.
fixes https://github.com/nbd-wtf/go-nostr/issues/161
This commit is contained in:
parent
2dba8fc3e0
commit
d0476edd06
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user