Browse Source

Explicit Initialization of Loop Counter in escapeJSON Function (#5796)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Micke 3 months ago
parent
commit
33513d1763
1 changed files with 1 additions and 1 deletions
  1. 1 1
      contracts/utils/Strings.sol

+ 1 - 1
contracts/utils/Strings.sol

@@ -465,7 +465,7 @@ library Strings {
         bytes memory output = new bytes(2 * buffer.length); // worst case scenario
         uint256 outputLength = 0;
 
-        for (uint256 i; i < buffer.length; ++i) {
+        for (uint256 i = 0; i < buffer.length; ++i) {
             bytes1 char = bytes1(_unsafeReadBytesOffset(buffer, i));
             if (((SPECIAL_CHARS_LOOKUP & (1 << uint8(char))) != 0)) {
                 output[outputLength++] = "\\";