The contract uses a magic number of 99 to indicate that no coin is "dead" (excluded by emergency calls).
See Controller.deadcoin. This only works because N_COINS is currently set to less than 99.
Impact
While it's unlikely that the protocol will ever support 99 stablecoins, it would still fail in that case and setting it to such a meaningless arbitrary value might indicate a further special meaning to anyone reading the code.
Recommended Mitigation Steps
We recommend using more meaningful constants like type(uint256).max or setting it to N_COINS + 1.
Handle
cmichel
Vulnerability details
Vulnerability Details
The contract uses a magic number of 99 to indicate that no coin is "dead" (excluded by emergency calls). See
Controller.deadcoin
. This only works becauseN_COINS
is currently set to less than 99.Impact
While it's unlikely that the protocol will ever support 99 stablecoins, it would still fail in that case and setting it to such a meaningless arbitrary value might indicate a further special meaning to anyone reading the code.
Recommended Mitigation Steps
We recommend using more meaningful constants like
type(uint256).max
or setting it toN_COINS + 1
.