title: How guard against unterminated strings
body: <p>In a C program I have a function that writes a message to a log file</p>
  
  <pre><code>LogResult writeLog(const char* format, ...)
  </code></pre>
  
  <p>That function passes its arguments on to 'vfprintf()' as a 'format' string and a 'va_list'. It just occurred to me that I don't have any control over what would happen if someone were to pass an unterminated string, e.g.</p>
  
  <pre><code>const char unterminatedString[5] = {'h', 'e', 'l', 'l', 'o'};
  writeLog("Log message: %s", unterminatedString);
  </code></pre>
  
  <p>Is there any way to guard against this?</p>