title: How does processor know how much to read from the stack for function parameters (x64)
body: <p>I have a small program running on x64 calling system function with a parameter long enough which means he will be pushed to function on the stack as I understand.</p>
  <pre><code>#include &lt;stdlib.h&gt;
  
  int main(void) {
      char command[] = &quot;/bin/sh -c whoami&quot;;
      system(command);
      return EXIT_SUCCESS;
  }
  </code></pre>
  <p>When I check in GDB what is happening I can confirm that my parameter is on the stack on 2 words.</p>
  <p><a href="https://i.stack.imgur.com/zDwWJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zDwWJ.png" alt="enter image description here" /></a></p>
  <p>I wonder how does the CPU know that it needs to read 2 words and not continue after. What delimit the function parameter from the rest ?</p>
  <p>I am asking this question as I am working on Buffer Overflow and while I have the same situation on the stack, the CPU does only pick one word (/bin/sh ) instead of the 2 words I would like. Outputing <code>sh: line 1: $'Ћ\310\367\377\177': command not found</code></p>
  <p><a href="https://i.stack.imgur.com/7muYK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7muYK.png" alt="enter image description here" /></a></p>