title: How do I prevent a char pointer buffer overflow?
body: <p>i.e. - </p>
  
  <pre><code>int function(char* txt)
  {
     sprintf(txt, "select * from %s;", table);
     //How do I set last char in buffer to NULL here?
  }
  </code></pre>
  
  <p>so if the text in table some how was 500 chars long and txt in the main was only defined as 100....</p>
  
  <p>thanks.</p>