Skip to content

Commit

Permalink
nip19: guard against broken TLVs.
Browse files Browse the repository at this point in the history
fixes #161
  • Loading branch information
fiatjaf committed Dec 18, 2024
1 parent 2dba8fc commit d0476ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nip19/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d0476ed

Please sign in to comment.