Adjust ERC2771Context._msgData for msg.data.length < 20 (#4484)

(cherry picked from commit 9445f96223)
This commit is contained in:
Francisco
2023-07-27 22:30:41 +02:00
committed by Francisco Giordano
parent 7ec712baa5
commit e4435eed75
4 changed files with 26 additions and 5 deletions

View File

@ -34,7 +34,7 @@ abstract contract ERC2771Context is Context {
}
function _msgData() internal view virtual override returns (bytes calldata) {
if (isTrustedForwarder(msg.sender)) {
if (isTrustedForwarder(msg.sender) && msg.data.length >= 20) {
return msg.data[:msg.data.length - 20];
} else {
return super._msgData();