title: Find addresses of a buffer
body: <p>I have an exercise in which I need to find the start and end address of a buffer (<code>buf2</code>). I don't have permissions to edit the code.</p>
  
  <p>Here is the code:</p>
  
  <p>(the password for the level2 code is fsckmelogic)</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;unistd.h&gt;
  int main(int argc, const char **argv) {
      if (argc &lt; 2) { printf("Fail. More Args...\n"); return 1; }
      else {
          setresuid(geteuid(),geteuid(),geteuid());
          char buf2[4096];
          char buf[16];
          const char password[]="XXXXXXXXXXX";
          strncpy(buf, argv[1], sizeof(buf) - 1);
          if (strcmp(buf,password) != 0) {
              printf("Wrong.\n");
              return 1;
          }
          else {
              strcpy(buf2,argv[2]);
              printf("%s",buf2);
              return 0;
          }
      }
  }
  </code></pre>