@@ -3357,22 +3357,23 @@ int wally_psbt_to_bytes(const struct wally_psbt *psbt, uint32_t flags,
33573357 return WALLY_OK ;
33583358}
33593359
3360- int wally_psbt_from_base64 (const char * base64 , uint32_t flags , struct wally_psbt * * output )
3360+ int wally_psbt_from_base64_n (const char * str_in , size_t str_len , uint32_t flags , struct wally_psbt * * output )
33613361{
33623362 unsigned char * decoded ;
33633363 size_t max_len , written ;
33643364 int ret ;
33653365
33663366 OUTPUT_CHECK ;
3367- if ((ret = wally_base64_get_maximum_length ( base64 , 0 , & max_len )) != WALLY_OK )
3367+ if ((ret = wally_base64_n_get_maximum_length ( str_in , str_len , 0 , & max_len )) != WALLY_OK )
33683368 return ret ;
33693369
33703370 /* Allocate the buffer to decode into */
33713371 if ((decoded = wally_malloc (max_len )) == NULL )
33723372 return WALLY_ENOMEM ;
33733373
33743374 /* Decode the base64 psbt into binary */
3375- if ((ret = wally_base64_to_bytes (base64 , 0 , decoded , max_len , & written )) != WALLY_OK )
3375+ ret = wally_base64_n_to_bytes (str_in , str_len , 0 , decoded , max_len , & written );
3376+ if (ret != WALLY_OK )
33763377 goto done ;
33773378
33783379 if (written <= sizeof (PSBT_MAGIC )) {
@@ -3392,6 +3393,12 @@ int wally_psbt_from_base64(const char *base64, uint32_t flags, struct wally_psbt
33923393 return ret ;
33933394}
33943395
3396+ int wally_psbt_from_base64 (const char * str_in , uint32_t flags , struct wally_psbt * * output )
3397+ {
3398+ size_t str_len = str_in ? strlen (str_in ) : 0 ;
3399+ return wally_psbt_from_base64_n (str_in , str_len , flags , output );
3400+ }
3401+
33953402int wally_psbt_to_base64 (const struct wally_psbt * psbt , uint32_t flags , char * * output )
33963403{
33973404 unsigned char * buff ;
0 commit comments