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/pam-python-1.0.9/src/ctest.c Examining data/pam-python-1.0.9/src/pam_python.c FINAL RESULTS: data/pam-python-1.0.9/src/ctest.c:107:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "/etc/pam.d/test-pam_%s.pam", pyver); data/pam-python-1.0.9/src/ctest.c:108:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(filename, 0) != 0) data/pam-python-1.0.9/src/ctest.c:122:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "test-pam_%s.pam", pyver); data/pam-python-1.0.9/src/ctest.c:134:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "/pam_%s.so", pyver); data/pam-python-1.0.9/src/pam_python.c:329:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(syslogFile->buffer, data); data/pam-python-1.0.9/src/pam_python.c:337:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(syslogFile->buffer, c); data/pam-python-1.0.9/src/pam_python.c:1178:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcat(strcpy(value_str, key_str), "="), Py23_String_AsString(value)); data/pam-python-1.0.9/src/pam_python.c:1178:19: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcat(strcpy(value_str, key_str), "="), Py23_String_AsString(value)); data/pam-python-1.0.9/src/pam_python.c:2390:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(doc_string, doc); data/pam-python-1.0.9/src/pam_python.c:2485:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcpy(module_path, module_dir), argv[0]); data/pam-python-1.0.9/src/pam_python.c:2485:10: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcpy(module_path, module_dir), argv[0]); data/pam-python-1.0.9/src/pam_python.c:2496:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(strcat(strcpy(module_data_name, MODULE_NAME), "."), module_path); data/pam-python-1.0.9/src/pam_python.c:2496:17: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcat(strcat(strcpy(module_data_name, MODULE_NAME), "."), module_path); data/pam-python-1.0.9/src/ctest.c:100: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 filename[128]; data/pam-python-1.0.9/src/pam_python.c:873: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 error_message[64]; data/pam-python-1.0.9/src/pam_python.c:2265:15: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). module_fp = fopen(module_path, "r"); data/pam-python-1.0.9/src/pam_python.c:314:11: [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). len = strlen(syslogFile->buffer); data/pam-python-1.0.9/src/pam_python.c:315:10: [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). len += strlen(data) + 1; data/pam-python-1.0.9/src/pam_python.c:1178:12: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(strcat(strcpy(value_str, key_str), "="), Py23_String_AsString(value)); data/pam-python-1.0.9/src/pam_python.c:2384:37: [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). char *doc_string = PyMem_Malloc(strlen(doc)+1); data/pam-python-1.0.9/src/pam_python.c:2478:24: [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). module_path = malloc(strlen(module_dir) + strlen(argv[0]) + 1); data/pam-python-1.0.9/src/pam_python.c:2478:45: [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). module_path = malloc(strlen(module_dir) + strlen(argv[0]) + 1); data/pam-python-1.0.9/src/pam_python.c:2489:29: [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). module_data_name = malloc(strlen(MODULE_NAME) + 1 + strlen(module_path) + 1); data/pam-python-1.0.9/src/pam_python.c:2489:55: [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). module_data_name = malloc(strlen(MODULE_NAME) + 1 + strlen(module_path) + 1); data/pam-python-1.0.9/src/pam_python.c:2496:10: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(strcat(strcpy(module_data_name, MODULE_NAME), "."), module_path); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 3083 in approximately 0.10 seconds (31657 lines/second) Physical Source Lines of Code (SLOC) = 2524 Hits@level = [0] 22 [1] 9 [2] 3 [3] 0 [4] 13 [5] 0 Hits@level+ = [0+] 47 [1+] 25 [2+] 16 [3+] 13 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 18.6212 [1+] 9.90491 [2+] 6.33914 [3+] 5.15055 [4+] 5.15055 [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.