title: C# creating buffer overflow
body: <p>I'm trying to create a buffer overflow with C# for a school project:</p>
  
  <pre><code>unsafe
  {
      fixed (char* ptr_str = new char[6] {'H', 'a', 'l', 'l', 'o', ','})
      {
          fixed (char* ptr_str2 = new char[6] {'W', 'e', 'r', 'e', 'l', 'd'})
          {
              fixed (char* ptr_str3 = new char[6] {'!', '!', '!', '!', '!', '!'})
              {
                  for (int i = 0; i &lt; 8; i++)
                  {
                      ptr_str2[i] = 'a';
                  }
  
                  for (int i = 0; i &lt; 6; i++)
                  {
                      this.Label2.Text += ptr_str[i];
                      this.Label3.Text += ptr_str2[i];
                      this.Label4.Text += ptr_str3[i];
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>I thought this would flood <code>ptr_str2</code> and thereby overwriting chars in <code>ptr_str</code>. However that does not seem to happen. It does execute but the values in <code>ptr_str</code> are not overwritten.</p>
  
  <p>Can anyone help with achieving this? I don't understand what I'm doing wrong.</p>