Compare commits

...

6 Commits

Author SHA1 Message Date
tobtoht
7fe199facc
Merge pull request #10061
a764f5a ci: macos: reinstall cmake (tobtoht)
2025-08-30 17:45:08 +00:00
tobtoht
a764f5a42a
ci: macos: reinstall cmake 2025-08-30 19:14:34 +02:00
tobtoht
0229f6fdde
Merge pull request #10046
a5b2ad0 BlockchainLMDB: do not assume alignment for alt block entries (jeffro256)
2025-08-30 17:08:26 +00:00
tobtoht
07dcc49bd7
Merge pull request #10056
ca48432 epee: only parse valid port (selsta)
2025-08-30 17:07:20 +00:00
selsta
ca484323c3
epee: only parse valid port
Reported by hacksandhops and Ada Logic.
2025-08-29 11:45:02 +02:00
jeffro256
a5b2ad04c5
BlockchainLMDB: do not assume alignment for alt block entries 2025-08-20 23:23:48 -05:00
3 changed files with 17 additions and 8 deletions

View File

@ -45,6 +45,7 @@ jobs:
- uses: ./.github/actions/set-make-job-count
- name: install dependencies
run: |
brew uninstall cmake
brew update
brew install --quiet cmake boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf ccache
- name: build

View File

@ -92,7 +92,13 @@ namespace net_utils
}
return true;
}
static bool parse_port(const std::string& port_str, uint64_t& out_port)
{
out_port = 0;
return boost::conversion::try_lexical_convert(port_str, out_port) && out_port <= 65535;
}
bool parse_uri(const std::string uri, http::uri_content& content)
{
@ -153,7 +159,8 @@ namespace net_utils
}
if(result[6].matched)
{
content.port = boost::lexical_cast<uint64_t>(result[6]);
if (!parse_port(result[6].str(), content.port))
return false;
}
if(result[7].matched)
{
@ -189,7 +196,8 @@ namespace net_utils
}
if(result[6].matched)
{
content.port = boost::lexical_cast<uint64_t>(result[6]);
if (!parse_port(result[6].str(), content.port))
return false;
}
if(result[7].matched)
{

View File

@ -2399,14 +2399,15 @@ bool BlockchainLMDB::for_all_alt_blocks(std::function<bool(const crypto::hash&,
const crypto::hash &blkid = *(const crypto::hash*)k.mv_data;
if (v.mv_size < sizeof(alt_block_data_t))
throw0(DB_ERROR("alt_blocks record is too small"));
const alt_block_data_t *data = (const alt_block_data_t*)v.mv_data;
alt_block_data_t data;
memcpy(&data, v.mv_data, sizeof(data));
cryptonote::blobdata_ref bd;
if (include_blob)
{
bd = {reinterpret_cast<const char*>(v.mv_data) + sizeof(alt_block_data_t), v.mv_size - sizeof(alt_block_data_t)};
}
if (!f(blkid, *data, &bd)) {
if (!f(blkid, data, &bd)) {
ret = false;
break;
}
@ -4519,11 +4520,10 @@ bool BlockchainLMDB::get_alt_block(const crypto::hash &blkid, alt_block_data_t *
if (v.mv_size < sizeof(alt_block_data_t))
throw0(DB_ERROR("Record size is less than expected"));
const alt_block_data_t *ptr = (const alt_block_data_t*)v.mv_data;
if (data)
*data = *ptr;
memcpy(data, v.mv_data, sizeof(alt_block_data_t));
if (blob)
blob->assign((const char*)(ptr + 1), v.mv_size - sizeof(alt_block_data_t));
blob->assign(((const char*)(v.mv_data)) + sizeof(alt_block_data_t), v.mv_size - sizeof(alt_block_data_t));
TXN_POSTFIX_RDONLY();
return true;