Skip to content

Commit de0bbc8

Browse files
ihsinmeMathiasVP
andauthored
Apply suggestions from code review
Co-authored-by: Mathias Vorreiter Pedersen <mathiasvp@github.com>
1 parent b899229 commit de0bbc8

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

cpp/ql/src/experimental/Security/CWE/CWE-788/AccessOfMemoryLocationAfterEndOfBufferUsingStrlen.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If terminal zero is present, then the specified expression is meaningless.</p>
1717
</recommendation>
1818
<example>
1919
<p>The following example demonstrates an erroneous and corrected use of the strlen function.</p>
20-
<sample src="AccessOfMemoryLocationAfterEndOfBuffer.c" />
20+
<sample src="AccessOfMemoryLocationAfterEndOfBufferUsingStrlen.c" />
2121

2222
</example>
2323
<references>

cpp/ql/src/experimental/Security/CWE/CWE-788/AccessOfMemoryLocationAfterEndOfBufferUsingStrlen.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
22
* @name Access Of Memory Location After End Of Buffer
3-
* @description --The expression buffer [strlen (buffer)] = 0 is potentially dangerous, if the variable buffer does not have a terminal zero, then access beyond the bounds of the allocated memory is possible, which will lead to undefined behavior.
4-
* --If terminal zero is present, then the specified expression is meaningless.
5-
* --We recommend using another method for calculating the string length.
3+
* @description The expression `buffer [strlen (buffer)] = 0` is potentially dangerous, if the variable `buffer` does not have a terminal zero, then access beyond the bounds of the allocated memory is possible, which will lead to undefined behavior.
4+
* If terminal zero is present, then the specified expression is meaningless.
65
* @kind problem
76
* @id cpp/access-memory-location-after-end-buffer
87
* @problem.severity warning

0 commit comments

Comments
 (0)