Platform: Code4rena
Start Date: 12/07/2022
Pot Size: $35,000 USDC
Total HM: 13
Participants: 78
Period: 3 days
Judge: 0xean
Total Solo HM: 6
Id: 135
League: ETH
Rank: 55/78
Findings: 1
Award: $48.55
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xDjango
Also found by: 0x1f8b, 8olidity, Bahurum, Lambda, arcoun, caventa, csanuragjain, hansfriese, joestakey, jonatascm, oyc_109, ronnyx2017
https://github.com/code-423n4/2022-07-swivel/blob/main/Creator/ZcToken.sol#L111-L115 https://github.com/code-423n4/2022-07-swivel/blob/main/Creator/ZcToken.sol#L132-L134 https://github.com/code-423n4/2022-07-swivel/blob/main/Tokens/ZcToken.sol#L111-L115 https://github.com/code-423n4/2022-07-swivel/blob/main/Tokens/ZcToken.sol#L111-L115
Detailed description of the impact of this finding.
Wrong operators are set.
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
[Line 111 - 115]
if (allowed >= previewAmount) { revert Approvals(allowed, previewAmount);}
should be changed to
if (allowed < previewAmount) { revert Approvals(allowed, previewAmount);}
[Line 132 - 134]
if (allowed >= principalAmount) { revert Approvals(allowed, principalAmount); }
should be changed to
if (allowed < principalAmount) { revert Approvals(allowed, principalAmount); }
Manual
Using the current code, If allowance < value, code will be reverted because of underflow after substraction if allowance >= value, code will be reverted because of the if statement
which is not what we want
#0 - scaraven
2022-07-17T08:44:22Z
duplicate of #180
#1 - JTraversa
2022-07-20T07:24:10Z
Duplicate of #129
#2 - bghughes
2022-07-31T19:58:15Z
Duplicate of #129