lnlink

iOS app for connecting to lightning nodes
git clone git://jb55.com/lnlink
Log | Files | Refs | Submodules | README | LICENSE

commit 053e50b71489ea3c5ab5d86e7d18a40fdf579515
parent b155814eb057e557aa831e548d290a9d249c905c
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 25 Mar 2022 15:38:16 -0700

bech32: dont crash if we get a bad decode

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mlightninglink/LNUrl.swift | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/lightninglink/LNUrl.swift b/lightninglink/LNUrl.swift @@ -63,6 +63,9 @@ func decode_bech32(_ str: String) -> Bech32? { str.withCString { input in typ = bech32_decode(hrp_ptr.baseAddress, bits_buf.baseAddress, &bitslen, input, str.count) bech32_convert_bits(data_buf.baseAddress, &datalen, 8, bits_buf.baseAddress, bitslen, 5, 0) + if datalen == 0 { + return + } m_data = Data(buffer: data_buf)[...(datalen-1)] m_hrp_str = String(cString: hrp_ptr.baseAddress!) }