Skip to content

Commit 764bfe4

Browse files
committed
[psbt] add file size limit
1 parent 1cd8dc2 commit 764bfe4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/psbt.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ static constexpr uint8_t PSBT_OUT_BIP32_DERIVATION = 0x02;
4040
// as a 0 length key which indicates that this is the separator. The separator has no value.
4141
static constexpr uint8_t PSBT_SEPARATOR = 0x00;
4242

43+
// BIP 174 does not specify a maximum file size, but we set a limit anyway
44+
// to prevent reading a stream indefinately and running out of memory.
45+
const std::streamsize MAX_FILE_SIZE_PSBT = 100000000; // 100 MiB
46+
4347
/** A structure for PSBTs which contain per-input information */
4448
struct PSBTInput
4549
{

0 commit comments

Comments
 (0)