Skip to content

Commit c883ce8

Browse files
alexetsubatoi
andcommitted
Apply suggestions from code review
Co-authored-by: Ben Ahmady <[email protected]>
1 parent da5c2d9 commit c883ce8

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

cpp/ql/src/Critical/IncorrectCheckScanf.qhelp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
<overview>
88
<p>
99
This query finds calls of <tt>scanf</tt>-like functions with
10-
improper return-value checking.
11-
</p>
12-
<p>
13-
Specifically, the query flags uses of <code>scanf</code> where the return value is checked
14-
only against zero.
10+
improper return-value checking. Specifically, it flags uses of <code>scanf</code> where the return value is only checked against zero.
1511
</p>
1612
<p>
1713
Functions in the <tt>scanf</tt> family return either <tt>EOF</tt> (a negative value)
@@ -24,13 +20,12 @@ is not enough.
2420
<recommendation>
2521
<p>
2622
Ensure that all uses of <tt>scanf</tt> check the return value against the expected number of arguments
27-
rather than just against zero
23+
rather than just against zero.
2824
</p>
2925
</recommendation>
3026

3127
<example>
32-
<p>This example shows different ways of guarding a <tt>scanf</tt> output:
33-
</p>
28+
<p>The following examples show different ways of guarding a <tt>scanf</tt> output. In the BAD examples, the results are only checked against zero. In the GOOD examples, the results are checked against the expected number of matches instead.</p>
3429
<sample src="IncorrectCheckScanf.cpp" />
3530
</example>
3631

0 commit comments

Comments
 (0)