GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codeql/cpp/ql/src/Critical/SizeCheck2.qhelp at codeql-cli/v2.25.2 · github/codeql Expand file tree/ Copy pathSizeCheck2.qhelpMore file actions 31 lines (25 loc) · 1.24 KB / Copy pathSizeCheck2.qhelpFile metadata and controls31 lines (25 loc) · 1.24 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 <!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd"> <qhelp> <overview> <p>When you allocate an array from memory using <code>malloc</code>, <code>calloc</code> or <code>realloc</code>, you should ensure that you allocate enough memory to contain a multiple of the size of the required pointer type. Calls that are assigned to a non-void pointer variable, but do not allocate enough memory will cause a buffer overflow when a field accessed on the pointer points to memory that is beyond the allocated array. Buffer overflows can lead to anything from a segmentation fault to a security vulnerability.</p> </overview> <recommendation> <p> The highlighted call allocates memory that is not a multiple of the size of the pointer type, which can cause a memory overrun. Use the <code>sizeof</code> operator to ensure that the function call allocates enough memory for that type. </p> </recommendation> <example><sample src="SizeCheck2.cpp" /> </example> <references> <li>I. Gerg. <em>An Overview and Example of the Buffer-Overflow Exploit</em>. IANewsletter vol 7 no 4. 2005.</li> <li>M. Donaldson. <em>Inside the Buffer Overflow Attack: Mechanism, Method & Prevention</em>. SANS Institute InfoSec Reading Room. 2002.</li> </references> </qhelp> |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |