nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit e9a8a7e2475816db0fcbf04953ccabdfacec515a
parent 70accf0421e72334368dedd7a6132daa55439ce8
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 29 Dec 2023 09:38:34 -0800

invoice: fix crash in any-amount invoice parsing

Diffstat:
Msrc/invoice.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/invoice.c b/src/invoice.c @@ -11,8 +11,7 @@ int ndb_encode_invoice(struct cursor *cur, struct bolt11 *invoice) { if (!cursor_push_byte(cur, 1)) return 0; - // TODO: make cursor_cursor_push_varint uint64_t - if (!cursor_push_varint(cur, invoice->msat->millisatoshis)) + if (!cursor_push_varint(cur, invoice->msat == NULL ? 0 : invoice->msat->millisatoshis)) return 0; if (!cursor_push_varint(cur, invoice->timestamp))