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/crda-4.14+git20191112.9856751/crda.c Examining data/crda-4.14+git20191112.9856751/db2rd.c Examining data/crda-4.14+git20191112.9856751/intersect.c Examining data/crda-4.14+git20191112.9856751/nl80211.h Examining data/crda-4.14+git20191112.9856751/optimize.c Examining data/crda-4.14+git20191112.9856751/regdb.h Examining data/crda-4.14+git20191112.9856751/regdbdump.c Examining data/crda-4.14+git20191112.9856751/reglib.h Examining data/crda-4.14+git20191112.9856751/reglib.c FINAL RESULTS: data/crda-4.14+git20191112.9856751/reglib.c:970:9: [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. hits = sscanf(line, "country %2[a-zA-Z0-9]:%*[ ]%s\n", data/crda-4.14+git20191112.9856751/crda.c:172:16: [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. env_country = getenv("COUNTRY"); data/crda-4.14+git20191112.9856751/crda.c:147:2: [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 alpha2[3]; data/crda-4.14+git20191112.9856751/crda.c:184:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(alpha2, env_country, 2); data/crda-4.14+git20191112.9856751/crda.c:187:8: [2] (misc) open: 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). fd = open(*regdb, O_RDONLY); data/crda-4.14+git20191112.9856751/reglib.c:90:2: [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[PATH_MAX]; data/crda-4.14+git20191112.9856751/reglib.c:121:19: [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 ((keyfile = fopen(filename, "rb"))) { data/crda-4.14+git20191112.9856751/reglib.c:222:12: [2] (misc) open: 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). ctx->fd = open(regdb_file, O_RDONLY); data/crda-4.14+git20191112.9856751/reglib.c:807:2: [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 line[1024]; data/crda-4.14+git20191112.9856751/reglib.c:937:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(rd, trd, sizeof(*trd)); data/crda-4.14+git20191112.9856751/reglib.c:962:2: [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 dfs_region_alpha[9]; data/crda-4.14+git20191112.9856751/reglib.c:963:2: [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 alpha2[2]; data/crda-4.14+git20191112.9856751/reglib.c:987:2: [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 line[1024]; data/crda-4.14+git20191112.9856751/reglib.c:1020: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 line[1024]; data/crda-4.14+git20191112.9856751/reglib.c:1067:7: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fp = tmpfile(); data/crda-4.14+git20191112.9856751/reglib.c:1074: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 line[1024]; data/crda-4.14+git20191112.9856751/reglib.c:1225:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(opt_rule, tmp_opt_rule, sizeof(*tmp_opt_rule)); data/crda-4.14+git20191112.9856751/reglib.c:1314:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(reg_rule_dst, reg_rule, sizeof(struct ieee80211_reg_rule)); data/crda-4.14+git20191112.9856751/reglib.c:1316:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(reg_rule_dst, opt_reg_rule, sizeof(struct ieee80211_reg_rule)); data/crda-4.14+git20191112.9856751/reglib.h:36:2: [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 alpha2[2]; data/crda-4.14+git20191112.9856751/reglib.c:1034:30: [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 (strspn(line, "\n") == strlen(line)) { ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 6264 in approximately 0.23 seconds (26939 lines/second) Physical Source Lines of Code (SLOC) = 2599 Hits@level = [0] 63 [1] 1 [2] 18 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 84 [1+] 21 [2+] 20 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 32.3201 [1+] 8.08003 [2+] 7.69527 [3+] 0.769527 [4+] 0.384763 [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.