From 10237ccb8e89d1579a3c84db76e135bd0858b7e9 Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 6 Aug 2020 13:17:47 -0500 Subject: [PATCH] psbt: handle 'NULL' or empty byte PSBTs Don't crash if the PSBT is null / zero-byte len. --- bitcoin/psbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin/psbt.c b/bitcoin/psbt.c index 6f91e7913..32d9c7524 100644 --- a/bitcoin/psbt.c +++ b/bitcoin/psbt.c @@ -742,7 +742,7 @@ struct wally_psbt *fromwire_wally_psbt(const tal_t *ctx, psbt_byte_len = fromwire_u32(cursor, max); psbt_buf = fromwire(cursor, max, NULL, psbt_byte_len); - if (!psbt_buf) + if (!psbt_buf || psbt_byte_len == 0) return NULL; psbt = psbt_from_bytes(ctx, psbt_buf, psbt_byte_len);