title: Format string attack in printf
body: <pre><code>#include &lt;stdio.h&gt;
  int main()
  {
      char s[200]
      int a=123;
      int b=&amp;a;
      scanf("%50s",s);
      printf(s);
  
      if (a==31337)
          func();
  }
  </code></pre>
  
  <p>The aim is to execute a format string attack - to execute func() by inputting a string. I tried to use %n to overwrite the variable but I came to conclusion is that it is impossible without displaying b variable first and I have no idea how. Any hint would be appreciated. Sorry for my bad english.</p>