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/menu-2.1.48/examples/menu.h Examining data/menu-2.1.48/install-menu/functions.cc Examining data/menu-2.1.48/install-menu/functions.h Examining data/menu-2.1.48/install-menu/hints.cc Examining data/menu-2.1.48/install-menu/hints.h Examining data/menu-2.1.48/install-menu/install-menu.cc Examining data/menu-2.1.48/install-menu/install-menu.h Examining data/menu-2.1.48/install-menu/menu-tree.cc Examining data/menu-2.1.48/install-menu/menu-tree.h Examining data/menu-2.1.48/update-menus/common.h Examining data/menu-2.1.48/update-menus/compose.hpp Examining data/menu-2.1.48/update-menus/exceptions.h Examining data/menu-2.1.48/update-menus/parsestream.cc Examining data/menu-2.1.48/update-menus/parsestream.h Examining data/menu-2.1.48/update-menus/stringtoolbox.cc Examining data/menu-2.1.48/update-menus/stringtoolbox.h Examining data/menu-2.1.48/update-menus/update-menus.cc Examining data/menu-2.1.48/update-menus/update-menus.h FINAL RESULTS: data/menu-2.1.48/install-menu/functions.cc:60:18: [4] (shell) popen: 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. FILE *status = popen(command.c_str(), "r"); data/menu-2.1.48/install-menu/install-menu.cc:104:3: [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(inbuf, str.c_str()); data/menu-2.1.48/install-menu/install-menu.cc:607:4: [4] (shell) system: 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. system((i.get_eq_stringconst()).c_str()); data/menu-2.1.48/install-menu/install-menu.cc:968:9: [4] (shell) system: 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. system(menumethod->remove->soutput(root_menu.vars).c_str()); data/menu-2.1.48/install-menu/install-menu.cc:984:7: [4] (shell) system: 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. system((menumethod->prerun->soutput(root_menu.vars)).c_str()); data/menu-2.1.48/install-menu/install-menu.cc:986:20: [4] (shell) system: 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. int retval = system((menumethod->preruntest->soutput(root_menu.vars)).c_str()); data/menu-2.1.48/install-menu/install-menu.cc:1028:9: [4] (shell) system: 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. system((menumethod->postrun->soutput(root_menu.vars)).c_str()); data/menu-2.1.48/update-menus/update-menus.cc:322:7: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(syslog_priority,message.c_str()); data/menu-2.1.48/update-menus/update-menus.cc:443:18: [4] (shell) popen: 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. FILE *status = popen(pkgs.c_str(), "r"); data/menu-2.1.48/update-menus/update-menus.cc:480:25: [4] (shell) popen: 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. FILE *exec_file = popen(filename.c_str(), "r"); data/menu-2.1.48/update-menus/update-menus.cc:604:5: [4] (shell) execv: 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. execv(args[0],(char **)args); data/menu-2.1.48/update-menus/update-menus.cc:659:5: [4] (shell) execv: 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. execv(args[0],(char **)args); data/menu-2.1.48/update-menus/update-menus.cc:814:11: [4] (shell) system: 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. if (system("dpkg-trigger --by-package=menu /usr/share/menu >/dev/null 2>&1") == 0) data/menu-2.1.48/install-menu/install-menu.cc:929:13: [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. int c = getopt_long (argc, argv, "vh", long_options, NULL); data/menu-2.1.48/update-menus/update-menus.cc:914:13: [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. int c = getopt_long (argc, argv, "hvd", long_options, NULL); data/menu-2.1.48/update-menus/update-menus.cc:1007:18: [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. home_dir = getenv("HOME"); data/menu-2.1.48/install-menu/functions.cc:67: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 tmp[MAX_LINE]; data/menu-2.1.48/install-menu/functions.cc:456: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 buf[300]; data/menu-2.1.48/install-menu/install-menu.cc:279: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 buf[2]="."; data/menu-2.1.48/install-menu/install-menu.cc:823:18: [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). input_file.open(input_filename2.c_str()); data/menu-2.1.48/update-menus/parsestream.cc:282: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 str[2]={0,0}; data/menu-2.1.48/update-menus/parsestream.cc:377:10: [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 atoi(s.c_str()); data/menu-2.1.48/update-menus/parsestream.cc:435: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[2] = {c, '\0'}; data/menu-2.1.48/update-menus/stringtoolbox.cc:137:10: [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 atoi(str.c_str()); data/menu-2.1.48/update-menus/update-menus.cc:453: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 tmp[MAX_LINE]; data/menu-2.1.48/update-menus/update-menus.cc:489: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 tmp[MAX_LINE]; data/menu-2.1.48/update-menus/update-menus.cc:658:5: [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). open("/dev/null", O_RDWR); data/menu-2.1.48/update-menus/update-menus.cc:718:10: [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(UPMEN_LOCKFILE,O_WRONLY|O_CREAT,00644); data/menu-2.1.48/update-menus/update-menus.cc:771: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(DPKG_LOCKFILE, O_RDWR|O_CREAT|O_TRUNC, 0660); data/menu-2.1.48/update-menus/update-menus.cc:1051:15: [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). int i = open(stdoutfile.c_str(), O_WRONLY|O_CREAT|O_SYNC|O_EXCL, 0666); data/menu-2.1.48/install-menu/install-menu.cc:924:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0022); data/menu-2.1.48/update-menus/parsestream.cc:44: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). re_compile_pattern(s, std::strlen(s), patt); data/menu-2.1.48/update-menus/parsestream.cc:117:33: [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). string t(s.substr(strlen("!include "))); data/menu-2.1.48/update-menus/update-menus.cc:455:15: [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 (tmp[strlen(tmp)-1] == '\n') data/menu-2.1.48/update-menus/update-menus.cc:456:15: [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). tmp[strlen(tmp)-1] = 0; ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 6390 in approximately 0.19 seconds (32970 lines/second) Physical Source Lines of Code (SLOC) = 4567 Hits@level = [0] 0 [1] 5 [2] 14 [3] 3 [4] 13 [5] 0 Hits@level+ = [0+] 35 [1+] 35 [2+] 30 [3+] 16 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 7.66367 [1+] 7.66367 [2+] 6.56886 [3+] 3.50339 [4+] 2.84651 [5+] 0 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.