Skip to content

Commit 8335778

Browse files
authored
Update ImproperCheckReturnValueScanf.qhelp
1 parent c0c7748 commit 8335778

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-754/ImproperCheckReturnValueScanf.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>Working with reading data without validation procedures and with uninitialized arguments can lead to unpredictable consequences.</p>
6+
<p>The `scanf` family functions does not require the memory pointed to by its additional pointer arguments to be initialized before calling. The user is required to check the return value of `scanf` and similar functions to establish how many of the additional arguments were assigned values. Not checking the return value and reading one of the arguments not assigned a value is undefined behavior and may have unexpected consequences.</p>
77
</overview>
88

99
<recommendation>
@@ -12,7 +12,7 @@ The user should check the return value of `scanf` and related functions and chec
1212
</p>
1313
</recommendation>
1414
<example>
15-
<p>The following example demonstrates erroneous and corrected work with a function call.</p>
15+
<p>The first first example below is correct, as value of `i` is only read once it is checked that `scanf` has read one item. The second example is incorrect, as the return value of `scanf` is not checked, and as `scanf` might have failed to read any item before returning.</p>
1616
<sample src="ImproperCheckReturnValueScanf.cpp" />
1717

1818
</example>

0 commit comments

Comments
 (0)