Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reco-3: add checks for parameters in function callTargets #82

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mainnet-contracts/src/PufferRevenueDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
* @dev Restricted access to `ROLE_ID_OPERATIONS_MULTISIG`
*/
function callTargets(address[] calldata targets, bytes[] calldata data) external restricted {
if (targets.length != data.length || targets.length == 0) {
revert InvalidDataLength();

Check warning on line 157 in mainnet-contracts/src/PufferRevenueDepositor.sol

View check run for this annotation

Codecov / codecov/patch

mainnet-contracts/src/PufferRevenueDepositor.sol#L157

Added line #L157 was not covered by tests
}

for (uint256 i = 0; i < targets.length; ++i) {
// nosemgrep arbitrary-low-level-call
(bool success,) = targets[i].call(data[i]);
Expand Down
5 changes: 5 additions & 0 deletions mainnet-contracts/src/interface/IPufferRevenueDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ pragma solidity >=0.8.0 <0.9.0;
* @custom:security-contact security@puffer.fi
*/
interface IPufferRevenueDepositor {
/**
* @notice Thrown when the calldata targets and data length don't match or are empty.
*/
error InvalidDataLength();

/**
* @notice Thrown when the target call fails.
*/
Expand Down
Loading