From 764bfe4cba35c24f7627cc425d9e7eba56e98964 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Thu, 26 Mar 2020 11:18:52 +0100 Subject: [psbt] add file size limit --- src/psbt.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/psbt.h') diff --git a/src/psbt.h b/src/psbt.h index dfba261961..7ea06b38f7 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -40,6 +40,10 @@ static constexpr uint8_t PSBT_OUT_BIP32_DERIVATION = 0x02; // as a 0 length key which indicates that this is the separator. The separator has no value. static constexpr uint8_t PSBT_SEPARATOR = 0x00; +// BIP 174 does not specify a maximum file size, but we set a limit anyway +// to prevent reading a stream indefinately and running out of memory. +const std::streamsize MAX_FILE_SIZE_PSBT = 100000000; // 100 MiB + /** A structure for PSBTs which contain per-input information */ struct PSBTInput { -- cgit v1.2.3