Skip to content

Commit

Permalink
avoid possible memcpy with nullptr when action data size is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
spoonincode committed Sep 18, 2023
1 parent cf0d9f4 commit 62cce64
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libraries/chain/webassembly/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace eosio { namespace chain { namespace webassembly {
int32_t interface::read_action_data(legacy_span<char> memory) const {
auto s = context.get_action().data.size();
if( s == 0 ) return s;
if( memory.size() == 0 ) return s;

auto copy_size = std::min( static_cast<size_t>(memory.size()), s );
Expand Down

0 comments on commit 62cce64

Please sign in to comment.