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-geoip-2.1.1/args.c Examining data/pam-geoip-2.1.1/check.c Examining data/pam-geoip-2.1.1/pam_geoip.c Examining data/pam-geoip-2.1.1/pam_geoip.h Examining data/pam-geoip-2.1.1/parse.c FINAL RESULTS: data/pam-geoip-2.1.1/check.c:84:17: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(location_string, "%s,%s", geo->country, geo->city); data/pam-geoip-2.1.1/pam_geoip.c:176:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. if (snprintf(opts->service_file, PATH_MAX-1, SERVICE_FILE, srv) < 0) { data/pam-geoip-2.1.1/parse.c:130:21: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. if ((service && sscanf(line, "%s %s %s %[^\n]", domain, service, action, location) != 4) || data/pam-geoip-2.1.1/parse.c:131:22: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. (!service && sscanf(line, "%s %s %[^\n]", domain, action, location) != 3) data/pam-geoip-2.1.1/check.c:71:21: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(location_string, "%.3f {%f,%f}", distance, geo->latitude, geo->longitude); data/pam-geoip-2.1.1/pam_geoip.c:76:5: [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[LINE_LENGTH]; data/pam-geoip-2.1.1/pam_geoip.c:246: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). if ((fh = fopen(opts->service_file, "r")) != NULL) { data/pam-geoip-2.1.1/pam_geoip.c:250:20: [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). else if ((fh = fopen(opts->system_file, "r")) == NULL) { data/pam-geoip-2.1.1/pam_geoip.c:258:5: [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 location[LINE_LENGTH]; data/pam-geoip-2.1.1/pam_geoip.c:261:9: [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 domain[LINE_LENGTH], service[LINE_LENGTH]; data/pam-geoip-2.1.1/parse.c:128:5: [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 action[LINE_LENGTH+1]; data/pam-geoip-2.1.1/check.c:23: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). if (!strncmp(services, srv, strlen(services)) || !strcmp(services, "*")) return 1; data/pam-geoip-2.1.1/parse.c:138:22: [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). str = location + strlen(location) - 1; ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 671 in approximately 0.04 seconds (16621 lines/second) Physical Source Lines of Code (SLOC) = 498 Hits@level = [0] 1 [1] 2 [2] 7 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 14 [1+] 13 [2+] 11 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 28.1124 [1+] 26.1044 [2+] 22.0884 [3+] 8.03213 [4+] 8.03213 [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.