title: Is there any safe strcmp?
body: <p>I made a function like this:</p>
  
  <pre><code>bool IsSameString(char* p1, char* p2) 
  {
       return 0 == strcmp(p1, p2);
  }
  </code></pre>
  
  <p>The problem is that sometimes, by mistake, arguments are passed which are not strings (meaning that <code>p1</code> or <code>p2</code> is not terminated with a null character).
  Then, <code>strcmp</code> continues comparing until it reaches non-accessible memory and crashes.
  Is there a safe version of <code>strcmp</code>? Or can I tell whether <code>p1</code> (and <code>p2</code>) is a string or not in a safe manner?</p>