Release v5.2 audit fixes (#5330)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com> Co-authored-by: Sam Bugs <101145325+0xsambugs@users.noreply.github.com> Co-authored-by: Ernesto García <ernestognw@gmail.com> Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com> Co-authored-by: wizard <112275929+famouswizard@users.noreply.github.com> Co-authored-by: leopardracer <136604165+leopardracer@users.noreply.github.com> Co-authored-by: cairo <cairoeth@protonmail.com>
This commit is contained in:
@ -57,7 +57,7 @@ library Clones {
|
||||
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
|
||||
*
|
||||
* This function uses the create2 opcode and a `salt` to deterministically deploy
|
||||
* the clone. Using the same `implementation` and `salt` multiple time will revert, since
|
||||
* the clone. Using the same `implementation` and `salt` multiple times will revert, since
|
||||
* the clones cannot be deployed twice at the same address.
|
||||
*/
|
||||
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
|
||||
@ -163,8 +163,8 @@ library Clones {
|
||||
* access the arguments within the implementation, use {fetchCloneArgs}.
|
||||
*
|
||||
* This function uses the create2 opcode and a `salt` to deterministically deploy the clone. Using the same
|
||||
* `implementation` and `salt` multiple time will revert, since the clones cannot be deployed twice at the same
|
||||
* address.
|
||||
* `implementation`, `args` and `salt` multiple times will revert, since the clones cannot be deployed twice
|
||||
* at the same address.
|
||||
*/
|
||||
function cloneDeterministicWithImmutableArgs(
|
||||
address implementation,
|
||||
@ -227,9 +227,9 @@ library Clones {
|
||||
* function should only be used to check addresses that are known to be clones.
|
||||
*/
|
||||
function fetchCloneArgs(address instance) internal view returns (bytes memory) {
|
||||
bytes memory result = new bytes(instance.code.length - 0x2d); // revert if length is too short
|
||||
bytes memory result = new bytes(instance.code.length - 45); // revert if length is too short
|
||||
assembly ("memory-safe") {
|
||||
extcodecopy(instance, add(result, 0x20), 0x2d, mload(result))
|
||||
extcodecopy(instance, add(result, 32), 45, mload(result))
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -248,11 +248,11 @@ library Clones {
|
||||
address implementation,
|
||||
bytes memory args
|
||||
) private pure returns (bytes memory) {
|
||||
if (args.length > 0x5fd3) revert CloneArgumentsTooLong();
|
||||
if (args.length > 24531) revert CloneArgumentsTooLong();
|
||||
return
|
||||
abi.encodePacked(
|
||||
hex"61",
|
||||
uint16(args.length + 0x2d),
|
||||
uint16(args.length + 45),
|
||||
hex"3d81600a3d39f3363d3d373d3d3d363d73",
|
||||
implementation,
|
||||
hex"5af43d82803e903d91602b57fd5bf3",
|
||||
|
||||
Reference in New Issue
Block a user