Skip to content

Commit

Permalink
Fix an unsafe intx::load.
Browse files Browse the repository at this point in the history
  • Loading branch information
yarkinwho committed Aug 14, 2023
1 parent 9759072 commit 37b8ee2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ void evm_contract::admincall(const bytes& from, const bytes& to, const bytes& va

// Prepare s
eosio::check(from.size() == kAddressLength, err_msg_invalid_addr);
intx::uint256 s = intx::be::unsafe::load<intx::uint256>((const uint8_t *)from.data());
// load will put the data in higher bytes, shift them donw.
s >>= 256 - kAddressLength * 8;
uint8_t s_buffer[32] = {};
memcpy(s_buffer + 32 - kAddressLength, from.data(), kAddressLength);
intx::uint256 s = intx::be::load<intx::uint256>(s_buffer);
// pad with '1's
s |= ((~intx::uint256(0)) << (kAddressLength * 8));

Expand Down

0 comments on commit 37b8ee2

Please sign in to comment.