what is stack smashing (C)?
<p>Code:</p>
<pre><code>int str_join(char *a,  const char *b) {
   int sz =0; 
   while(*a++) sz++;  
   char *st = a -1, c;  
   *st = (char) 32;
   while((c = *b++)) *++st = c;  
   *++st = 0;
   return sz;
}

....

char a[] = &quot;StringA&quot;; 
printf(&quot;string-1 length = %d, String a = %s\n&quot;, str_join(&amp;a[0],&quot;StringB&quot;), a);
</code></pre>
<p>Output:</p>
<blockquote>
<p>string-1 length = 7, char *a = StringA StringB</p>
<p>*** stack smashing detected **** : /T02 terminated</p>
<p>Aborted (core dumped)</p>
</blockquote>
<p>I don't understand why it's showing <em>stack smashing</em>? and what is *stack smashing? Or is it my compiler's error?</p>