Make ERC2771Context return original sender address if msg.data.length <= 20 (#4481)

This commit is contained in:
Ernesto García
2023-07-25 15:48:23 -06:00
committed by GitHub
parent 19293f3ecd
commit 28d9ac2bdb
3 changed files with 17 additions and 1 deletions

View File

@ -22,7 +22,7 @@ abstract contract ERC2771Context is Context {
}
function _msgSender() internal view virtual override returns (address sender) {
if (isTrustedForwarder(msg.sender)) {
if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {
// The assembly code is more direct than the Solidity version using `abi.decode`.
/// @solidity memory-safe-assembly
assembly {