diff options
author | fanquake <fanquake@gmail.com> | 2023-11-01 10:40:34 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-11-01 10:44:55 +0000 |
commit | 67b25125603aacaa445bf6e9f0147789a039a679 (patch) | |
tree | e9011f280928954d4766386cecdb5716d1badcd0 /src/i2p.cpp | |
parent | 7d0e5b099c71d6280315dffcfaf16835344e685f (diff) | |
parent | e4e84790f62990f31a519f1ec0e8cc16e93a3c3b (diff) |
Merge bitcoin/bitcoin#28754: [26.x] Backports for rc2v26.0rc2
e4e84790f62990f31a519f1ec0e8cc16e93a3c3b doc: update manual pages for v26.0rc2 (fanquake)
0b189a90926eaa6694b4031fe31c111e2f5052ae build: bump version to v26.0rc2 (fanquake)
e097d4cb5329e9037c0e66d1c71b1bc5a02d56e6 gui: fix crash on selecting "Mask values" in transaction view (Sebastian Falbesoner)
05e887455454813465a2a5b376df672f199bfbf9 guix: update signapple (fanquake)
deccc506314c467f1e87e0a48a94626df841fe63 guix: Zip needs to include all files with time as SOURCE_DATE_EPOCH (Andrew Chow)
fe57abd7e9c3d08553589a54a4f63f69960f78fd test: add coverage for snapshot chainstate not matching AssumeUTXO parameters (pablomartin4btc)
b761a58171f2a7b2249211840aeb203a37dc8b13 assumeutxo, blockstorage: prevent core dump on invalid hash (pablomartin4btc)
d3ebf6e9fcb8459695ea58cc2a551c0a7b1dd881 [test] Test i2p private key constraints (Vasil Dimov)
1f11784aac33c4d6aa5beccec19e6ff025808b24 [net] Check i2p private key constraints (dergoegge)
6544ffa01fc1f219817e8c22b5d1d44ea2efa465 bugfix: Mark CNoDestination and PubKeyDestination constructor explicit (MarcoFalke)
Pull request description:
Backports for v26.0rc2:
* #28695
* #28698
* #28728
* #28757
* #28759
* https://github.com/bitcoin-core/gui/pull/774
ACKs for top commit:
josibake:
ACK https://github.com/bitcoin/bitcoin/commit/e4e84790f62990f31a519f1ec0e8cc16e93a3c3b
hebasto:
re-ACK e4e84790f62990f31a519f1ec0e8cc16e93a3c3b, only a backport of https://github.com/bitcoin-core/gui/pull/774 added since my [recent](https://github.com/bitcoin/bitcoin/pull/28754#pullrequestreview-1707143194) review.
TheCharlatan:
Re-ACK e4e84790f62990f31a519f1ec0e8cc16e93a3c3b
Tree-SHA512: 4b95afd26b8bf91250cb883423de8b274cefa48dc474734f5900aeb756eee3a6c656116efcfa2caff3c250678c16b70cc6b7a5d840018dc7e2c1e8161622cd61
Diffstat (limited to 'src/i2p.cpp')
-rw-r--r-- | src/i2p.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/i2p.cpp b/src/i2p.cpp index 05a5dde396..685b43ba18 100644 --- a/src/i2p.cpp +++ b/src/i2p.cpp @@ -384,11 +384,26 @@ Binary Session::MyDestination() const static constexpr size_t CERT_LEN_POS = 385; uint16_t cert_len; + + if (m_private_key.size() < CERT_LEN_POS + sizeof(cert_len)) { + throw std::runtime_error(strprintf("The private key is too short (%d < %d)", + m_private_key.size(), + CERT_LEN_POS + sizeof(cert_len))); + } + memcpy(&cert_len, &m_private_key.at(CERT_LEN_POS), sizeof(cert_len)); cert_len = be16toh(cert_len); const size_t dest_len = DEST_LEN_BASE + cert_len; + if (dest_len > m_private_key.size()) { + throw std::runtime_error(strprintf("Certificate length (%d) designates that the private key should " + "be %d bytes, but it is only %d bytes", + cert_len, + dest_len, + m_private_key.size())); + } + return Binary{m_private_key.begin(), m_private_key.begin() + dest_len}; } |