Following code shows reading of balance:
function WithdrawBuggy(uint256 amount) public {
uint256 bal = balance[msg.sender];
require(amount <= bal);
balance[msg.sender] -= amount;
require(msg.sender.call.value(amount)());
if (balance[msg.sender] != bal) {
emit BalanceDecreased(msg.sender);
}
}
Can the attacker exploit reading of balance?
Zulfi.