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/bridge-utils-1.6/brctl/brctl.c Examining data/bridge-utils-1.6/brctl/brctl.h Examining data/bridge-utils-1.6/brctl/brctl_cmd.c Examining data/bridge-utils-1.6/brctl/brctl_disp.c Examining data/bridge-utils-1.6/libbridge/libbridge.h Examining data/bridge-utils-1.6/libbridge/libbridge_devif.c Examining data/bridge-utils-1.6/libbridge/libbridge_if.c Examining data/bridge-utils-1.6/libbridge/libbridge_init.c Examining data/bridge-utils-1.6/libbridge/libbridge_misc.c Examining data/bridge-utils-1.6/libbridge/libbridge_private.h FINAL RESULTS: data/bridge-utils-1.6/libbridge/libbridge_devif.c:163:2: [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. snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge", bridge); data/bridge-utils-1.6/libbridge/libbridge_devif.c:254:2: [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. snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brport", port); data/bridge-utils-1.6/libbridge/libbridge_devif.c:307:2: [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. snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/bridge/%s", data/bridge-utils-1.6/libbridge/libbridge_devif.c:365:2: [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. snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brport/%s", ifname, name); data/bridge-utils-1.6/libbridge/libbridge_devif.c:418:2: [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. snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brforward", bridge); data/bridge-utils-1.6/libbridge/libbridge_init.c:59:2: [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. snprintf(path, SYSFS_PATH_MAX, data/bridge-utils-1.6/libbridge/libbridge_init.c:204:2: [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. snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brif", brname); data/bridge-utils-1.6/brctl/brctl.c:47:14: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((f = getopt_long(argc, argv, "Vh", options, NULL)) != EOF) data/bridge-utils-1.6/libbridge/libbridge_misc.c:48:19: [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. const char * s = getenv("HZ"); data/bridge-utils-1.6/libbridge/libbridge.h:35:11: [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 prio[2]; data/bridge-utils-1.6/libbridge/libbridge.h:36:11: [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 addr[6]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:33: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:36:9: [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). return fopen(path, "r"); data/bridge-utils-1.6/libbridge/libbridge_devif.c:131: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(&info->designated_root, &i.designated_root, 8); data/bridge-utils-1.6/libbridge/libbridge_devif.c:132: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(&info->bridge_id, &i.bridge_id, 8); data/bridge-utils-1.6/libbridge/libbridge_devif.c:161: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:227: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(&info->designated_root, &i.designated_root, 8); data/bridge-utils-1.6/libbridge/libbridge_devif.c:228: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(&info->designated_bridge, &i.designated_bridge, 8); data/bridge-utils-1.6/libbridge/libbridge_devif.c:252: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:286: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 buf[32]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:288:7: [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(path, O_WRONLY); data/bridge-utils-1.6/libbridge/libbridge_devif.c:305: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:363: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:403: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(ent->mac_addr, f->mac_addr, 6); data/bridge-utils-1.6/libbridge/libbridge_devif.c:415: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_devif.c:419:6: [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). f = fopen(path, "r"); data/bridge-utils-1.6/libbridge/libbridge_if.c:39: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 _br[IFNAMSIZ]; data/bridge-utils-1.6/libbridge/libbridge_if.c:59: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 _br[IFNAMSIZ]; data/bridge-utils-1.6/libbridge/libbridge_init.c:49: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_init.c:103: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 ifname[IFNAMSIZ]; data/bridge-utils-1.6/libbridge/libbridge_init.c:158: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 ifname[IFNAMSIZ]; data/bridge-utils-1.6/libbridge/libbridge_init.c:202: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 path[SYSFS_PATH_MAX]; data/bridge-utils-1.6/libbridge/libbridge_misc.c:28:14: [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. static const char *state_names[5] = { data/bridge-utils-1.6/libbridge/libbridge_misc.c:49:13: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). return s ? atoi(s) : HZ; data/bridge-utils-1.6/libbridge/libbridge_devif.c:94:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, brname, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_devif.c:122:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, bridge, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_devif.c:216:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, brname, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_devif.c:315:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, bridge, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_devif.c:376:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, bridge, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_devif.c:432:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, bridge, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_if.c:43:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(_br, brname, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_if.c:63:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(_br, brname, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_if.c:78:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, bridge, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_if.c:103:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, bridge, IFNAMSIZ); data/bridge-utils-1.6/libbridge/libbridge_init.c:164:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifr.ifr_name, brname, IFNAMSIZ); ANALYSIS SUMMARY: Hits = 45 Lines analyzed = 1794 in approximately 0.08 seconds (21888 lines/second) Physical Source Lines of Code (SLOC) = 1304 Hits@level = [0] 114 [1] 11 [2] 25 [3] 2 [4] 7 [5] 0 Hits@level+ = [0+] 159 [1+] 45 [2+] 34 [3+] 9 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 121.933 [1+] 34.5092 [2+] 26.0736 [3+] 6.90184 [4+] 5.3681 [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.