code-423n4 / 2021-10-badgerdao-findings

0 stars 0 forks source link

balanceToShares should handle division by 0 case #77

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

function balanceToShares should handle a case when pricePerShare drops to 0. Currently, this will produce a runtime division by zero error. While in theory, this is an unlikely scenario but in practice, you should consider returning 0 in such a case.

Recommended Mitigation Steps

Return 0 if pricePerShare is 0.

0xleastwood commented 2 years ago

70