Skip to content

Commit

Permalink
Check if invalid address
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto committed Mar 4, 2024
1 parent 8fc541b commit 1676832
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ contract DefaultReverseResolver is
*/
function resolve(bytes calldata _name, bytes calldata data) external view returns (bytes memory result) {
bytes4 selector = bytes4(data);
(address addr,) = HexUtils.hexToAddress(_name, 1, ADDRESS_LENGTH + 1);
(address addr,bool valid) = HexUtils.hexToAddress(_name, 1, ADDRESS_LENGTH + 1);
require(valid, "Invalid address");

if (selector == INameResolver.name.selector) {
return bytes(name(addr));
}
Expand Down

0 comments on commit 1676832

Please sign in to comment.