title: How to skip a line doing a buffer overflow in C
body: <p>I want to skip a line in C, the line <code>x=1;</code> in the main section using <code>bufferoverflow</code>; however, I don't know why I can not skip the address from <code>4002f4</code> to the next address <code>4002fb</code> in spite of the fact that I am counting 7 bytes form <code>&lt;main+35&gt;</code> to <code>&lt;main+42&gt;</code>.</p>
  
  <p>I also have configured the options the randomniZation and execstack environment in a Debian and AMD environment, but I am still getting <code>x=1;</code>. What it's wrong with this procedure?</p>
  
  <p>I have used dba to debug the stack and the memory addresses:</p>
  
  <pre><code>0x00000000004002ef &lt;main+30&gt;:    callq  0x4002a4 **&lt;function&gt;**  
  **0x00000000004002f4** &lt;main+35&gt;:    movl   $0x1,-0x4(%rbp)  
  **0x00000000004002fb** &lt;main+42&gt;:    mov    -0x4(%rbp),%esi  
  0x00000000004002fe &lt;main+45&gt;:    mov    $0x4629c4,%edi  
  
  void function(int a, int b, int c)  
  {
    char buffer[5];
    int *ret;
  
    ret = buffer + 12;
    (*ret) += 8; 
  }
  
  int main()
  {
     int x = 0; 
     function(1, 2, 3);
     x = 1;
     printf("x = %i \n", x);  
     return 0;  
  }
  </code></pre>