title: Using snprintf to avoid buffer overruns
body: <p>I am using <code>snprintf</code> like this to avoid a buffer overrun:</p>
  
  <pre><code>char err_msg[32] = {0};
  snprintf(err_msg, sizeof(err_msg) - 1, "[ ST_ENGINE_FAILED ]");
  </code></pre>
  
  <p>I added the <code>-1</code> to reserve space for the null terminator in case the string is more than 32 bytes long.</p>
  
  <p>Am I correct in my thinking?</p>
  
  <p>Platform:</p>
  
  <ul>
  <li>GCC 4.4.1</li>
  <li>C99</li>
  </ul>