Closed code423n4 closed 3 years ago
This adds a gas cost for all instances in exchange for saving gas for someone who intentionally passed in a zero value or had no collateral. This would almost certainly have a net increase in overall gas spent by all users.
Handle
shw
Vulnerability details
Impact
In
Router.sol
, the functionborrowForMember
calls an internal function,_handleTransferIn
, which may return 0. In such a case,borrowForMember
can directly return to save gas since the zero value of_collateral
does not affect any following logic.Proof of Concept
Referenced code: Router.sol#L316 Router.sol#L386-L393
Tools Used
None
Recommended Mitigation Steps
Add
if (_collateral == 0) return;
to save gas if_collateral
is equal to 0.