diff --git a/cpp/ql/src/Critical/IncorrectCheckScanf.cpp b/cpp/ql/src/Critical/IncorrectCheckScanf.cpp index ef881421182..acec7143c63 100644 --- a/cpp/ql/src/Critical/IncorrectCheckScanf.cpp +++ b/cpp/ql/src/Critical/IncorrectCheckScanf.cpp @@ -1,7 +1,7 @@ { int i, j; - // BAD:The result is only checked against zero + // BAD: The result is only checked against zero if (scanf("%d %d", &i, &j)) { use(i); use(j); diff --git a/cpp/ql/src/Critical/IncorrectCheckScanf.qhelp b/cpp/ql/src/Critical/IncorrectCheckScanf.qhelp index 6aeb6ed01a2..1d9a9fabb36 100644 --- a/cpp/ql/src/Critical/IncorrectCheckScanf.qhelp +++ b/cpp/ql/src/Critical/IncorrectCheckScanf.qhelp @@ -10,11 +10,11 @@ This query finds calls of scanf-like functions with improper return-value checking.

-Specifically, the query flags uses of scanf wehere the reurn value is checked +Specifically, the query flags uses of scanf where the return value is checked only against zero.

-Functions in the scanf family return either EOF (a negative value) +Functions in the scanf family return either EOF (a negative value) in case of IO failure, or the number of items successfully read from the input. Consequently, a simple check that the return value is nonzero is not enough.