mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
C++: Fix some easy FPs.
This commit is contained in:
@@ -19,9 +19,10 @@ private predicate suspicious(string s) {
|
||||
s.matches("%trusted%")
|
||||
) and
|
||||
not (
|
||||
s.matches("%hashed%") or
|
||||
s.matches("%encrypted%") or
|
||||
s.matches("%crypt%")
|
||||
s.matches("%hash%") or
|
||||
s.matches("%crypt%") or
|
||||
s.matches("%file%") or
|
||||
s.matches("%conf%")
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
| test2.cpp:28:2:28:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:28:36:28:43 | password | this source. |
|
||||
| test2.cpp:29:2:29:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:29:37:29:45 | thepasswd | this source. |
|
||||
| test2.cpp:30:2:30:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:30:38:30:47 | accountkey | this source. |
|
||||
| test2.cpp:31:2:31:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:31:41:31:53 | password_hash | this source. |
|
||||
| test2.cpp:33:2:33:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:33:41:33:53 | password_file | this source. |
|
||||
| test2.cpp:34:2:34:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:34:41:34:53 | passwd_config | this source. |
|
||||
| test.cpp:45:3:45:7 | call to fputs | This write into file 'file' may contain unencrypted data from $@ | test.cpp:45:9:45:19 | thePassword | this source. |
|
||||
| test.cpp:70:35:70:35 | call to operator<< | This write into file 'mystream' may contain unencrypted data from $@ | test.cpp:70:38:70:48 | thePassword | this source. |
|
||||
| test.cpp:73:37:73:41 | call to write | This write into file 'mystream' may contain unencrypted data from $@ | test.cpp:73:43:73:53 | thePassword | this source. |
|
||||
|
||||
@@ -37,7 +37,7 @@ void tests(FILE *log, myStruct &s)
|
||||
char *cpy1 = s.password;
|
||||
char *cpy2 = crypt(s.password);
|
||||
|
||||
fprintf(log, "cpy1 = %s\n", cpy1); // BAD
|
||||
fprintf(log, "cpy1 = %s\n", cpy1); // BAD [NOT DETECTED]
|
||||
fprintf(log, "cpy2 = %s\n", cpy2); // GOOD
|
||||
}
|
||||
|
||||
@@ -45,10 +45,9 @@ void tests(FILE *log, myStruct &s)
|
||||
char buf[1024];
|
||||
|
||||
strcpy(buf, s.password);
|
||||
fprintf(log, "buf = %s\n", buf); // BAD
|
||||
fprintf(log, "buf = %s\n", buf); // BAD [NOT DETECTED]
|
||||
|
||||
strcpy(buf, s.password_hash);
|
||||
fprintf(log, "buf = %s\n", buf); // GOOD
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user