Closed code423n4 closed 1 year ago
https://github.com/code-423n4/2023-01-drips/blob/9fd776b50f4be23ca038b1d0426e63a69c7a511d/src/Drips.sol#L492
Rather than iterate and continue if user is not the expected one, this code breaks all the execution if first user is userId
continue
userId
Execution is broke most of the times at first iteration
for (; idx < receivers.length; idx++) { DripsReceiver memory receiver = receivers[idx]; if (receiver.userId != userId) break; (uint32 start, uint32 end) = _dripsRange(receiver, updateTime, maxEnd, squeezeStartCap, squeezeEndCap); amt += _drippedAmt(receiver.config.amtPerSec(), start, end); }
Code not working if first user is not expected one
Manual Review
Use continue rather than break
break
for (; idx < receivers.length; idx++) { DripsReceiver memory receiver = receivers[idx]; - if (receiver.userId != userId) break; + if (receiver.userId != userId) continue; (uint32 start, uint32 end) = _dripsRange(receiver, updateTime, maxEnd, squeezeStartCap, squeezeEndCap); amt += _drippedAmt(receiver.config.amtPerSec(), start, end); }
GalloDaSballo marked the issue as duplicate of #71
GalloDaSballo marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2023-01-drips/blob/9fd776b50f4be23ca038b1d0426e63a69c7a511d/src/Drips.sol#L492
Vulnerability details
Code breaks if first user is not expected user
Summary
Rather than iterate and
continue
if user is not the expected one, this code breaks all the execution if first user isuserId
Vulnerability Detail
Execution is broke most of the times at first iteration
Impact
Code not working if first user is not expected one
Code Snippet
Tool used
Manual Review
Recommendation
Use
continue
rather thanbreak