Open code423n4 opened 2 years ago
WatchPug
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/CDSTemplate.sol#L260-L270
if (_available >= _amount) { _compensated = _amount; _attributionLoss = vault.transferValue(_amount, msg.sender); emit Compensated(msg.sender, _amount); } else { //when CDS cannot afford, pay as much as possible _compensated = _available; _attributionLoss = vault.transferValue(_available, msg.sender); emit Compensated(msg.sender, _available); }
Change to:
_compensated = _available >= _amount? _amount: _available; _attributionLoss = vault.transferValue(_compensated, msg.sender); emit Compensated(msg.sender, _compensated);
@oishun1112 already fixed.
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2022-01-insure/blob/19d1a7819fe7ce795e6d4814e7ddf8b8e1323df3/contracts/CDSTemplate.sol#L260-L270
Recommendation
Change to: