strcmp crashes even though both strings are sane
<p>I have a peculiar problem where my program crashes at strcmp.</p>

<p>Upon gdb core analysis I see that both the strings being checked are sane meaning their pointers are not NULL and they contain finite null terminated values.</p>

<p>However one of the strings is garbage (not the one the variable is intended to contain)</p>

<p>Leaving aside the fact that it is garbage, I really want to know why strcmp would crash for 2 sane strings ? What could be the possible causes of this ?</p>

<p>Thanks in advance!</p>

<p>EDIT:</p>

<p>An example,</p>

<pre><code>a = strcmp(b,c);
(gdb) p b
$92 = 0x7f58d3a36b89 "H\205\300uRH\215}\320\350\a\300\361\377A\276"
(gdb) p c
$93 = 0x2041e48 "MAIN"
</code></pre>