Skip to content

Commit

Permalink
fix: fixes out of bounds crash when waku2 is not set (#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta committed Aug 8, 2023
1 parent c8446ae commit 03363f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions waku/v2/waku_enr/capabilities.nim
Expand Up @@ -76,6 +76,9 @@ func waku2*(record: TypedRecord): Option[CapabilitiesBitfield] =
if field.isNone():
return none(CapabilitiesBitfield)

if field.get().len != 1:
return none(CapabilitiesBitfield)

some(CapabilitiesBitfield(field.get()[0]))

proc supportsCapability*(r: Record, cap: Capabilities): bool =
Expand Down

0 comments on commit 03363f1

Please sign in to comment.