mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
C++: More test cases.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
| 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: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. |
|
||||
| test2.cpp:40:3:40:9 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:37:18:37:25 | password | this source. |
|
||||
| test2.cpp:35:2:35:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:35:36:35:43 | password | this source. |
|
||||
| test2.cpp:36:2:36:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:36:37:36:45 | thepasswd | this source. |
|
||||
| test2.cpp:41:2:41:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:41:41:41:53 | passwd_config | this source. |
|
||||
| test2.cpp:42:2:42:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:42:41:42:53 | num_passwords | this source. |
|
||||
| test2.cpp:43:2:43:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:43:39:43:49 | have_passwd | this source. |
|
||||
| test2.cpp:45:2:45:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:45:39:45:49 | call to getPassword | this source. |
|
||||
| test2.cpp:47:2:47:8 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:47:47:47:65 | call to getPasswordMaxChars | this source. |
|
||||
| test2.cpp:53:3:53:9 | call to fprintf | This write into file 'log' may contain unencrypted data from $@ | test2.cpp:50:18:50:25 | password | 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. |
|
||||
|
||||
@@ -19,10 +19,17 @@ struct myStruct
|
||||
|
||||
// not sensitive
|
||||
char *password_file;
|
||||
int num_passwords;
|
||||
bool have_passwd;
|
||||
|
||||
// dubious
|
||||
char *passwd_config;
|
||||
};
|
||||
|
||||
char *getPassword();
|
||||
char *getPasswordHash();
|
||||
int getPasswordMaxChars();
|
||||
|
||||
void tests(FILE *log, myStruct &s)
|
||||
{
|
||||
fprintf(log, "password = %s\n", s.password); // BAD
|
||||
@@ -32,6 +39,12 @@ void tests(FILE *log, myStruct &s)
|
||||
fprintf(log, "encrypted_passwd = %s\n", s.encrypted_passwd); // GOOD
|
||||
fprintf(log, "password_file = %s\n", s.password_file); // GOOD
|
||||
fprintf(log, "passwd_config = %s\n", s.passwd_config); // DUBIOUS [REPORTED]
|
||||
fprintf(log, "num_passwords = %i\n", s.num_passwords); // GOOD [FALSE POSITIVE]
|
||||
fprintf(log, "have_passwd = %i\n", s.have_passwd); // GOOD [FALSE POSITIVE]
|
||||
|
||||
fprintf(log, "getPassword() = %i\n", getPassword()); // BAD
|
||||
fprintf(log, "getPasswordHash() = %i\n", getPasswordHash()); // GOOD
|
||||
fprintf(log, "getPasswordMaxChars() = %i\n", getPasswordMaxChars()); // GOOD [FALSE POSITIVE]
|
||||
|
||||
{
|
||||
char *cpy1 = s.password;
|
||||
|
||||
Reference in New Issue
Block a user