The amount of citadel bought when there is no discount is always zero. If the user doesn't specify, or specifies zero as the _minCitadelOut, then the user will get no xCitadel and will still have to pay the full price.
Proof of Concept
If funding.discount is equal to zero, citadelAmount_ will remain at the uninitialized value of zero rather than the correct value of citadelAmountWithoutDiscount
Lines of code
https://github.com/code-423n4/2022-04-badger-citadel/blob/18f8c392b6fc303fe95602eba6303725023e53da/src/Funding.sol#L202-L216
Vulnerability details
The amount of citadel bought when there is no discount is always zero. If the user doesn't specify, or specifies zero as the
_minCitadelOut
, then the user will get no xCitadel and will still have to pay the full price.Proof of Concept
If
funding.discount
is equal to zero,citadelAmount_
will remain at the uninitialized value of zero rather than the correct value ofcitadelAmountWithoutDiscount
File: src/Funding.sol (lines 202-216)
Tools Used
Code inspection
Recommended Mitigation Steps
Initialize
citadelAmount_
tocitadelAmountWithoutDiscount