title: Improper NULL Termination c/c++
body: <p>I am recently trying a static code analyzer on existing c++ source (mixed with C ). I found many error occurs when i tried something like this </p>
  
  <pre><code>char* buff= new char[length];
  size_t readbytes = fread(buff,length,1, file)
  </code></pre>
  
  <p>I get improper null pointer termination on buff. I tried something like this -</p>
  
  <pre><code>if((readbytes=fread(buff,length,1,file))&lt;length){ /*dont do anything*/}
  else {/*rest of the code*/}
  </code></pre>
  
  <p>which does not worked.
  Also tried to check with <code>strlen(buff) == length</code> - also did not work.</p>
  
  <p>Similar high risk issues I got with memcpy, memmove  when my dest is of type <code>char[constant size]</code></p>
  
  <p>what I am missing here to make it write so that no null termination risk can be avoided?</p>