Skip to content

Commit 2d0e6fe

Browse files
committed
descriptor (taproot): check return value as well as returned length
1 parent ccffda1 commit 2d0e6fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/descriptor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,13 +1422,13 @@ static int generate_tr(ms_ctx *ctx, ms_node *node,
14221422
{
14231423
unsigned char tweaked[EC_PUBLIC_KEY_LEN];
14241424
unsigned char pubkey[EC_PUBLIC_KEY_UNCOMPRESSED_LEN + 1];
1425-
size_t pubkey_len;
1425+
size_t pubkey_len = 0;
14261426
int ret;
14271427

14281428
/* Generate a push of the x-only public key of our child */
14291429
const bool force_xonly = true;
14301430
ret = generate_pk_k_impl(ctx, node, pubkey, sizeof(pubkey), force_xonly, &pubkey_len);
1431-
if (pubkey_len != EC_XONLY_PUBLIC_KEY_LEN + 1)
1431+
if (ret != WALLY_OK || pubkey_len != EC_XONLY_PUBLIC_KEY_LEN + 1)
14321432
return WALLY_EINVAL; /* Should be PUSH_32 [x-only pubkey] */
14331433

14341434
/* Tweak it into a compressed pubkey */

0 commit comments

Comments
 (0)