How Does the Use of Transfer or Send Help Enforce the CEI Pattern?
The use of the Solidity functions transfer() and send() for sending Ether helps enforce the CEI pattern by limiting the gas forwarded to the recipient contract to 2300 gas. This gas limit is typically insufficient for the recipient to execute a complex state-changing function, which is necessary for a reentrancy attack.
By effectively preventing a recursive call, these functions act as a simple, built-in reentrancy guard for the Ether transfer part of the Interactions step.