Submitted by Jeiwan, also found by joestakey, berndartmueller, smiling_heretic, adriro, hansfriese, and bin2chen
A borrower can close a credit without repaying the debt to the lender. The lender will be left with a bad debt and the borrower will keep the borrowed amount and the collateral.
The close function of LineOfCredit doesnt check whether a credit exists or not. As a result, the count variable is decreased in the internal _close function when the close function is called with an non-existent credit ID:
LineOfCredit.sol#L388:
LineOfCredit.sol#L483:
Proof of Concept:
In the close function of LineOfCredit, consider ensuring that a credit with the user-supplied ID exists, before closing it.
kibagateaux (Debt DAO) confirmed
