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/mininet-2.2.2/mnexec.c Examining data/mininet-2.2.2/util/sch_htb-ofbuf/sch_htb.c FINAL RESULTS: data/mininet-2.2.2/mnexec.c:208:9: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(argv[optind], &argv[optind]); data/mininet-2.2.2/mnexec.c:105:17: [3] (buffer) getopt: 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 ((c = getopt(argc, argv, "+cdnpa:g:r:vh")) != -1) data/mininet-2.2.2/mnexec.c:173:21: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(path) < 0) { data/mininet-2.2.2/mnexec.c:69:12: [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 char path[PATH_MAX]; data/mininet-2.2.2/mnexec.c:81:13: [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, "w"); data/mininet-2.2.2/mnexec.c:99: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 path[PATH_MAX]; data/mininet-2.2.2/mnexec.c:156:19: [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). pid = atoi(optarg); data/mininet-2.2.2/mnexec.c:157:13: [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(path, "/proc/%d/ns/net", pid); data/mininet-2.2.2/mnexec.c:158:20: [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). nsid = open(path, O_RDONLY); data/mininet-2.2.2/mnexec.c:168:13: [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(path, "/proc/%d/ns/mnt", pid); data/mininet-2.2.2/mnexec.c:169:20: [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). nsid = open(path, O_RDONLY); data/mininet-2.2.2/mnexec.c:172:17: [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(path, "/proc/%d/root", pid); data/mininet-2.2.2/mnexec.c:190:33: [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). sp.sched_priority = atoi(optarg); ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 1860 in approximately 0.06 seconds (33427 lines/second) Physical Source Lines of Code (SLOC) = 1332 Hits@level = [0] 7 [1] 0 [2] 10 [3] 2 [4] 1 [5] 0 Hits@level+ = [0+] 20 [1+] 13 [2+] 13 [3+] 3 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 15.015 [1+] 9.75976 [2+] 9.75976 [3+] 2.25225 [4+] 0.750751 [5+] 0 Symlinks skipped = 1 (--allowlink overrides but see doc for security issue) 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.