Skip to content

Commit 7b4300e

Browse files
C++: Apply suggestions in documentation
Co-authored-by: Sarah Edwards <[email protected]>
1 parent 9d49ad9 commit 7b4300e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cpp/ql/src/Security/CWE/CWE-120/OverrunWrite.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<p>To fix this issue these changes should be made:</p>
1616
<ul>
17-
<li>Control the size of the buffer by declaring it with a compile time constant</li>
17+
<li>Control the size of the buffer by declaring it with a compile time constant.</li>
1818
<li>Preferably, replace the call to <code>sprintf</code> with <code>snprintf</code>, using the defined constant size of the buffer or `sizeof(buffer)` as maximum length to write. This will prevent the buffer overflow.</li>
1919
<li>Optionally, if `userId` is expected to be less than `10000`, then return or throw an error if `userId` is out of bounds.</li>
2020
<li>Otherwise, consider increasing the buffer size to at least 25 characters, so that the message is displayed correctly regardless of the value of `userId`.</li>

cpp/ql/src/Security/CWE/CWE-120/VeryLikelyOverrunWrite.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6-
<p>The program performs a buffer copy or write operation with no upper limit on the size of the copy, and by analysing the bounds of the expressions involved it appears that certain inputs will cause a buffer overflow to occur in this case. In addition to causing program instability, techniques exist which may allow an attacker to use this vulnerability to execute arbitrary code.</p>
6+
<p>The program performs a buffer copy or write operation with no upper limit on the size of the copy. By analyzing the bounds of the expressions involved, it appears that certain inputs will cause a buffer overflow to occur in this case. In addition to causing program instability, techniques exist which may allow an attacker to use this vulnerability to execute arbitrary code.</p>
77

88
</overview>
99
<include src="OverrunWriteRecommendation.inc.qhelp" />
@@ -14,7 +14,7 @@
1414

1515
<p>To fix this issue these changes should be made:</p>
1616
<ul>
17-
<li>Control the size of the buffer by declaring it with a compile time constant</li>
17+
<li>Control the size of the buffer by declaring it with a compile time constant.</li>
1818
<li>Preferably, replace the call to <code>sprintf</code> with <code>snprintf</code>, using the defined constant size of the buffer or `sizeof(buffer)` as maximum length to write. This will prevent the buffer overflow.</li>
1919
<li>Increasing the buffer size to account for the full range of `userId` and the terminating null character.</li>
2020
</ul>

0 commit comments

Comments
 (0)