Skip to content

Commit

Permalink
docs: document offset 22
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Sep 30, 2024
1 parent 5e4e40c commit 54ee8b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/EthernautCTF/MagicNumberExploit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ contract MagicNumberExploit is Test {
// PUSH1 0x00
// MSTORE
// 2. Return 10 bytes from memory, starting at offset 22.
// Why an offset of 22? Because the runtime code length is 10 bytes and when we store it in
// memory, it's padded with zero bytes (22 zero bytes) to get a 32-byte value.
// PUSH1 0x0a (10 in hexadecimal)
// PUSH1 0x16 (22 in hexadecimal)
// RETURN
Expand Down

0 comments on commit 54ee8b8

Please sign in to comment.