approve() overwrites an existing non-zero allowance directly. A spender watching the mempool can spend the old allowance and then also spend the new one, transferring more than the owner intended.
// owner has approved 100. Owner sends approve(50). // spender front-runs: transferFrom(100). Then the approve(50) lands. // spender transferFrom(50). Total spent = 150 > intended.
// force allowance through zero, or use increase/decreaseAllowance token.approve(spender, 0); token.approve(spender, newAmount); // or: token.safeIncreaseAllowance(spender, delta);
The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0109 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.