Closed c4-bot-2 closed 9 months ago
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L147
Impact:We should check parameters: The input parameter of StakingRewards.claimAllRewards(),and the parameter poolID in the function.
We should check input parameter of poolIDs , inner paramter of poolID to prevent error.
function claimAllRewards( bytes32[] calldata poolIDs ) external nonReentrant returns (uint256 claimableRewards) { mapping(bytes32=>UserShareInfo) storage userInfo = _userShareInfo[msg.sender]; claimableRewards = 0; for( uint256 i = 0; i < poolIDs.length; i++ ) { bytes32 poolID = poolIDs[i]; uint256 pendingRewards = userRewardForPool( msg.sender, poolID ); ..... } ..... }
vscode foundry
Need add revert or require.
Error
Picodes marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-01-salty/blob/53516c2cdfdfacb662cdea6417c52f23c94d5b5b/src/staking/StakingRewards.sol#L147
Vulnerability details
Impact:We should check parameters: The input parameter of StakingRewards.claimAllRewards(),and the parameter poolID in the function.
Proof of Concept
We should check input parameter of poolIDs , inner paramter of poolID to prevent error.
function claimAllRewards( bytes32[] calldata poolIDs ) external nonReentrant returns (uint256 claimableRewards) { mapping(bytes32=>UserShareInfo) storage userInfo = _userShareInfo[msg.sender]; claimableRewards = 0; for( uint256 i = 0; i < poolIDs.length; i++ ) { bytes32 poolID = poolIDs[i]; uint256 pendingRewards = userRewardForPool( msg.sender, poolID ); ..... } ..... }
Tools Used
vscode foundry
Recommended Mitigation Steps
Need add revert or require.
Assessed type
Error