Skip to content

Commit 2e92689

Browse files
alexetMathiasVP
andauthored
CPP: Apply suggestions from code review of incorrect scanf check
Co-authored-by: Mathias Vorreiter Pedersen <[email protected]>
1 parent f3f5357 commit 2e92689

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cpp/ql/src/Critical/IncorrectCheckScanf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
int i, j;
33

4-
// BAD:The result is only checked against zero
4+
// BAD: The result is only checked against zero
55
if (scanf("%d %d", &i, &j)) {
66
use(i);
77
use(j);

cpp/ql/src/Critical/IncorrectCheckScanf.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ This query finds calls of <tt>scanf</tt>-like functions with
1010
improper return-value checking.
1111
</p>
1212
<p>
13-
Specifically, the query flags uses of scanf wehere the reurn value is checked
13+
Specifically, the query flags uses of <code>scanf</code> where the return value is checked
1414
only against zero.
1515
</p>
1616
<p>
17-
Functions in the <tt>scanf</tt> family return either EOF (a negative value)
17+
Functions in the <tt>scanf</tt> family return either <tt>EOF</tt> (a negative value)
1818
in case of IO failure, or the number of items successfully read from the
1919
input. Consequently, a simple check that the return value is nonzero
2020
is not enough.

0 commit comments

Comments
 (0)