Fix 5.2 audit L-05, N-03, N-04, N-05 and N-06 issues (#5308)
This commit is contained in:
@ -27,15 +27,13 @@ library Bytes {
|
||||
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
|
||||
*/
|
||||
function indexOf(bytes memory buffer, bytes1 s, uint256 pos) internal pure returns (uint256) {
|
||||
unchecked {
|
||||
uint256 length = buffer.length;
|
||||
for (uint256 i = pos; i < length; ++i) {
|
||||
if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {
|
||||
return i;
|
||||
}
|
||||
uint256 length = buffer.length;
|
||||
for (uint256 i = pos; i < length; ++i) {
|
||||
if (bytes1(_unsafeReadBytesOffset(buffer, i)) == s) {
|
||||
return i;
|
||||
}
|
||||
return type(uint256).max;
|
||||
}
|
||||
return type(uint256).max;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,10 +2,9 @@
|
||||
|
||||
pragma solidity ^0.8.24;
|
||||
|
||||
import {SafeCast} from "./math/SafeCast.sol";
|
||||
import {Bytes} from "./Bytes.sol";
|
||||
import {CAIP2} from "./CAIP2.sol";
|
||||
import {Strings} from "./Strings.sol";
|
||||
import {CAIP2} from "./CAIP2.sol";
|
||||
|
||||
/**
|
||||
* @dev Helper library to format and parse CAIP-10 identifiers
|
||||
@ -16,7 +15,6 @@ import {Strings} from "./Strings.sol";
|
||||
* account_address: [-.%a-zA-Z0-9]{1,128}
|
||||
*/
|
||||
library CAIP10 {
|
||||
using SafeCast for uint256;
|
||||
using Strings for address;
|
||||
using Bytes for bytes;
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
pragma solidity ^0.8.24;
|
||||
|
||||
import {SafeCast} from "./math/SafeCast.sol";
|
||||
import {Bytes} from "./Bytes.sol";
|
||||
import {Strings} from "./Strings.sol";
|
||||
|
||||
@ -15,7 +14,6 @@ import {Strings} from "./Strings.sol";
|
||||
* reference: [-_a-zA-Z0-9]{1,32}
|
||||
*/
|
||||
library CAIP2 {
|
||||
using SafeCast for uint256;
|
||||
using Strings for uint256;
|
||||
using Bytes for bytes;
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
|
||||
import {Nonces} from "./Nonces.sol";
|
||||
|
||||
/**
|
||||
* @dev Alternative to {Nonces}, that support key-ed nonces.
|
||||
* @dev Alternative to {Nonces}, that supports key-ed nonces.
|
||||
*
|
||||
* Follows the https://eips.ethereum.org/EIPS/eip-4337#semi-abstracted-nonce-support[ERC-4337's semi-abstracted nonce system].
|
||||
*/
|
||||
@ -19,7 +19,7 @@ abstract contract NoncesKeyed is Nonces {
|
||||
/**
|
||||
* @dev Consumes the next unused nonce for an address and key.
|
||||
*
|
||||
* Returns the current value without the key prefix. Consumed nonce is increased, so calling this functions twice
|
||||
* Returns the current value without the key prefix. Consumed nonce is increased, so calling this function twice
|
||||
* with the same arguments will return different (sequential) results.
|
||||
*/
|
||||
function _useNonce(address owner, uint192 key) internal virtual returns (uint256) {
|
||||
|
||||
Reference in New Issue
Block a user