code-423n4 / 2022-01-insure-findings

2 stars 0 forks source link

Missing divide by 0 check on `_totalLiquidity` #330

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Dravee

Vulnerability details

Impact

Division by 0

Proof of Concept

While there's a check that _totalLiquidity >= _lockedAmount, there isn't one for _totalLiquidity != 0 (and _lockedAmount can be 0): https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PremiumModels/BondingPremium.sol#L70

Tools Used

VS Code

Recommended Mitigation Steps

Check that the value isn't 0

oishun1112 commented 2 years ago

similar issue https://github.com/code-423n4/2022-01-insure-findings/issues/287