mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
Update cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp
Co-Authored-By: Jonas Jensen <jbj@github.com>
This commit is contained in:
@@ -22,7 +22,7 @@ To check whether an index <code>i</code> is less than the length of an array,
|
||||
simply compare these two numbers as unsigned integers: <code>i < ARRAY_LENGTH</code>.
|
||||
If the length of the array is defined as the difference between two pointers
|
||||
<code>ptr</code> and <code>p_end</code>, write <code>i < p_end - ptr</code>.
|
||||
If i is <code>signed</code>, cast it to <code>unsigned</code>
|
||||
If <code>i</code> is signed, cast it to unsigned
|
||||
in order to guard against negative <code>i</code>. For example, write
|
||||
<code>(size_t)i < p_end - ptr</code>.
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user