File tree Expand file tree Collapse file tree
cpp/ql/test/query-tests/Critical/MissingCheckScanf Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33| test.cpp:204:7:204:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
44| test.cpp:436:7:436:11 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
55| test.cpp:443:11:443:15 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
6+ | test.cpp:467:8:467:12 | call to scanf | The result of scanf is only checked against 0, but it can also return EOF. |
Original file line number Diff line number Diff line change @@ -458,4 +458,18 @@ void disjunct_boolean_condition(const char* modifier_data) {
458458 return ;
459459 }
460460 use (value); // GOOD
461+ }
462+
463+ void check_for_negative_test () {
464+ int res;
465+ int value;
466+
467+ res = scanf (" %d" , &value); // GOOD [FALSE POSITIVE]
468+ if (res == 0 ) {
469+ return ;
470+ }
471+ if (res < 0 ) {
472+ return ;
473+ }
474+ use (value);
461475}
You can’t perform that action at this time.
0 commit comments