title: stack protector does not throw error with strcpy()
body: <p>I'm testing an example of stack protector from ARM reference document (<a href="https://developer.arm.com/documentation/101754/0616/armclang-Reference/armclang-Command-line-Options/-fstack-protector---fstack-protector-all---fstack-protector-strong---fno-stack-protector" rel="nofollow noreferrer">https://developer.arm.com/documentation/101754/0616/armclang-Reference/armclang-Command-line-Options/-fstack-protector---fstack-protector-all---fstack-protector-strong---fno-stack-protector</a>), which has code like:</p>
  <pre class="lang-c prettyprint-override"><code>    // main.c
      #include &lt;stdio.h&gt;
      #include &lt;stdlib.h&gt;
      
      void *__stack_chk_guard = (void *)0xdeadbeef;
      
      void __stack_chk_fail(void)
      {
          fprintf(stderr, &quot;Stack smashing detected.\n&quot;);
          exit(1);
      }
      
      void get_input(char *data);
      
      
      char main(void)
      {
          char buffer[8] = { 0 };
          char *overflowed = &amp;buffer[8];
      
          get_input(buffer);
          // =============================================================
          // The following line is added by me. This triggers stack smashing,
          // but strcpy() should also trigger stack smashing detect.
          // *overflowed = 0xFF;
          printf(&quot;buffer: %s\n&quot;, buffer);
          printf(&quot;buffer addr: 0x%08x\n&quot;, buffer[8]);
          // =============================================================
          return buffer[0];
      }
      
      // get.c
      #include &lt;string.h&gt;
      
      void get_input(char *data)
      {
          strcpy(data, &quot;01234567&quot;);
      }
  </code></pre>
  <p>I think this code intends to make stack overflow by accessing extra memory(buffer[8]) for NULL character using strcpy(). But the actual behavior is that no messages are thrown at all.</p>
  <pre class="lang-sh prettyprint-override"><code>➜  stack_protector gcc main.c get.c -o test -fstack-protector-all
  ➜  stack_protector ./test
  buffer: 01234567
  buffer addr: 0x00000000
  </code></pre>
  <p>I checked that stack protector cannot detect smashing error if the stack size is smaller than 8 bytes, but this is not the case I think. Is there anything I am missing?</p>