20,000 USDC
View results
Submission Details
Severity: gas
Valid

Should check mapping key exists before using

Summary

lots of devs forget that using a random key to get a value from the mapping will return an object with default values

Vulnerability Details

Loan memory loan = loans[loanId]

some flawed validation that does not check the zero values in a non-existing mapping value

Impact

If loadId doesn't exist, loan will be default value, may interfere data usage afterwards

Tools Used

Manual Review

Recommendations

Add explicit checks to revert in this case, validate mapping key exists before using

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.