You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context:
Solidity developers often make the mistake of assigning or comparing addresses to the zero address (0x0000000000000000000000000000000000000000). This can lead to vulnerabilities and bugs in smart contracts.
Suggestion:
Implement a new rule in Solhint to check for:
Assignments to the zero address.
Comparisons with the zero address.
Rationale:
This check will help developers avoid common pitfalls and ensure better security and reliability in their smart contracts.
Assignments to the zero address:
Are you referring to assign to a variable address(0) ? or what ?
Comparisons with the zero address.
Is this what you mean ?
if (userAddress == address(0)) or if (userAddress == 0x0000000000000000000000000000000000000000)
I am referring to cases where a variable is assigned the value address(0).
I am talking about instances where an assignment to the zero address is possible but not checked against. Example:
function transferOwnership(address newOwner) public {
require(newOwner != address(0), "New owner cannot be the zero address");
owner = newOwner;
}
My question is if there should be a hint to check for a zero address allocation if the require statement is not present.
This would help to prevent problems like this RHO incident.
Context:
Solidity developers often make the mistake of assigning or comparing addresses to the zero address (
0x0000000000000000000000000000000000000000
). This can lead to vulnerabilities and bugs in smart contracts.Suggestion:
Implement a new rule in Solhint to check for:
Rationale:
This check will help developers avoid common pitfalls and ensure better security and reliability in their smart contracts.
References:
The text was updated successfully, but these errors were encountered: