Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c Examining data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c FINAL RESULTS: data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:35:21: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEBUG(X...) fprintf(stderr, X) data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:43:17: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. return strdup(crypt(passwd, "$6$")); data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:132:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TMP")) { data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:133:14: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. tmpdir = getenv("TMP"); data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:65:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TEST_USER") == NULL || getenv("TEST_PASSWD") == NULL) { data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:65:38: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TEST_USER") == NULL || getenv("TEST_PASSWD") == NULL) { data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:71:22: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. test_user = strdup(getenv("TEST_USER")); data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:72:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. test_passwd_hash = pwhash(getenv("TEST_PASSWD")); data/golang-go.crypto-0.0~git20201016.9e8e0b3/ssh/test/sshd_test_pw.c:80:34: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. DEBUG("\tTEST_PASSWD: '%s'\n", getenv("TEST_PASSWD")); data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:38:60: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. void new_fingerprint(void *opdata, OtrlUserState us, const char *accountname, data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:39:28: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *protocol, const char *username, data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:39:50: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. const char *protocol, const char *username, data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:40:31: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char fingerprint[20]) { data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:136:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char private_key_file[256]; data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:139:12: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd = mkstemp(private_key_file); data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:152:3: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buf[4096]; data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:156:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(message) == 0) { data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:159:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). message[strlen(message) - 1] = 0; data/golang-go.crypto-0.0~git20201016.9e8e0b3/otr/libotr_test_helper.c:185:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). write(1, newmessage, strlen(newmessage)); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 370 in approximately 0.17 seconds (2182 lines/second) Physical Source Lines of Code (SLOC) = 258 Hits@level = [0] 12 [1] 3 [2] 7 [3] 7 [4] 2 [5] 0 Hits@level+ = [0+] 31 [1+] 19 [2+] 16 [3+] 9 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 120.155 [1+] 73.6434 [2+] 62.0155 [3+] 34.8837 [4+] 7.75194 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.