Skip to content

Commit eda33ad

Browse files
committed
C++: Add FP.
1 parent a84332a commit eda33ad

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

cpp/ql/test/query-tests/Security/CWE/CWE-311/semmle/tests/CleartextTransmission.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ nodes
138138
| test3.cpp:577:2:577:25 | ... = ... | semmle.label | ... = ... |
139139
| test3.cpp:577:8:577:23 | call to get_home_address | semmle.label | call to get_home_address |
140140
| test3.cpp:578:14:578:16 | str | semmle.label | str |
141+
| test3.cpp:585:25:585:32 | password | semmle.label | password |
141142
subpaths
142143
| test3.cpp:138:24:138:32 | password1 | test3.cpp:117:28:117:33 | buffer | test3.cpp:117:13:117:14 | *id | test3.cpp:138:21:138:22 | call to id |
143144
#select
@@ -181,3 +182,4 @@ subpaths
181182
| test3.cpp:559:3:559:6 | call to send | test3.cpp:556:19:556:30 | salaryString | test3.cpp:559:15:559:20 | *buffer | This operation transmits '*buffer', which may contain unencrypted sensitive data from $@. | test3.cpp:556:19:556:30 | salaryString | salaryString |
182183
| test3.cpp:572:2:572:5 | call to send | test3.cpp:571:8:571:21 | call to get_home_phone | test3.cpp:572:14:572:16 | str | This operation transmits 'str', which may contain unencrypted sensitive data from $@. | test3.cpp:571:8:571:21 | call to get_home_phone | call to get_home_phone |
183184
| test3.cpp:578:2:578:5 | call to send | test3.cpp:577:8:577:23 | call to get_home_address | test3.cpp:578:14:578:16 | str | This operation transmits 'str', which may contain unencrypted sensitive data from $@. | test3.cpp:577:8:577:23 | call to get_home_address | call to get_home_address |
185+
| test3.cpp:585:2:585:7 | call to fscanf | test3.cpp:585:25:585:32 | password | test3.cpp:585:25:585:32 | password | This operation receives into 'password', which may put unencrypted sensitive data into $@. | test3.cpp:585:25:585:32 | password | password |

cpp/ql/test/query-tests/Security/CWE/CWE-311/semmle/tests/test3.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,10 @@ void tests3()
577577
str = get_home_address();
578578
send(val(), str, strlen(str), val()); // BAD
579579
}
580+
581+
int fscanf(FILE* stream, const char* format, ... );
582+
583+
void test_scanf() {
584+
char password[256];
585+
fscanf(stdin, "%255s", password); // GOOD [FALSE POSITIVE]: this is not a remote source
586+
}

0 commit comments

Comments
 (0)