Bufferoverflow, snprintf instead char resizes? : <p>I have a hard time to understand why the below code is not resulting in a bufferoverflow and instead some how seems to resize the char example from 1 to 16.</p>

<p>I checked the snprintf documentation but nothing to be found about this.</p>

<pre><code>//set char example size 1
char example[1];

//set example to args-&gt;arg2 which is a 15 character + 1 null byte.
//trying to put something to big into something too small, in my mind causing not a resize but a bof.

snprintf(example, 16, "%s", args-&gt;arg2); 

fprintf(stdout,"[%s],example);
</code></pre>

<p>The fprintf in the end does not display 1 character nor does char example overflows but instead it seems to be resized and displays the full string of 16.</p>

<p>What am i misunderstanding here ?</p>
