title: heap corruption detected | C++
body: <p>I get this "<code>heap corruption detected</code>" message after running this code :</p>
  
  <pre><code>uli&amp; uli::operator =(char* n)
  {
      char* buffer = new char[strlen(n)];
  
      char* p;
      int op;
      int coef;
  
      strcpy(buffer, n);
  
      while(*buffer)
      {
          op = strlen(buffer) - 5;
          p = (op &gt;= 0) ? op+buffer : buffer;
          coef = atoi(p);
  
          if(coef &gt; 65535)
              coef = atoi(++p);
  
          push(head, coef);
          *p = '\0';
      }
  
      delete buffer;       //  &lt;- heap corruption detected
  
      return *this;
  }
  </code></pre>
  
  <p>This is how I call the method:</p>
  
  <pre><code>uli x;
  x = "9876123";
  </code></pre>
  
  <p>What does "heap corruption detected" mean ?</p>