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/zypper-1.14.11/src/Command.cc Examining data/zypper-1.14.11/src/Command.h Examining data/zypper-1.14.11/src/Config.cc Examining data/zypper-1.14.11/src/Config.h Examining data/zypper-1.14.11/src/PackageArgs.cc Examining data/zypper-1.14.11/src/PackageArgs.h Examining data/zypper-1.14.11/src/RequestFeedback.cc Examining data/zypper-1.14.11/src/SolverRequester.cc Examining data/zypper-1.14.11/src/SolverRequester.h Examining data/zypper-1.14.11/src/Summary.cc Examining data/zypper-1.14.11/src/Summary.h Examining data/zypper-1.14.11/src/Table.cc Examining data/zypper-1.14.11/src/Table.h Examining data/zypper-1.14.11/src/ZCOMMAND.cc Examining data/zypper-1.14.11/src/ZCOMMAND.h Examining data/zypper-1.14.11/src/Zypper.h Examining data/zypper-1.14.11/src/callbacks/job.h Examining data/zypper-1.14.11/src/callbacks/keyring.h Examining data/zypper-1.14.11/src/callbacks/locks.h Examining data/zypper-1.14.11/src/callbacks/media.cc Examining data/zypper-1.14.11/src/callbacks/media.h Examining data/zypper-1.14.11/src/callbacks/repo.h Examining data/zypper-1.14.11/src/callbacks/rpm.h Examining data/zypper-1.14.11/src/commands/basecommand.cc Examining data/zypper-1.14.11/src/commands/basecommand.h Examining data/zypper-1.14.11/src/commands/commandhelpformatter.cc Examining data/zypper-1.14.11/src/commands/commandhelpformatter.h Examining data/zypper-1.14.11/src/commands/locks.h Examining data/zypper-1.14.11/src/commands/locks/add.cc Examining data/zypper-1.14.11/src/commands/locks/add.h Examining data/zypper-1.14.11/src/commands/locks/list.cc Examining data/zypper-1.14.11/src/commands/locks/list.h Examining data/zypper-1.14.11/src/commands/locks/remove.cc Examining data/zypper-1.14.11/src/commands/locks/remove.h Examining data/zypper-1.14.11/src/configtest.cc Examining data/zypper-1.14.11/src/configtest.h Examining data/zypper-1.14.11/src/download.cc Examining data/zypper-1.14.11/src/download.h Examining data/zypper-1.14.11/src/info.cc Examining data/zypper-1.14.11/src/info.h Examining data/zypper-1.14.11/src/locks.cc Examining data/zypper-1.14.11/src/locks.h Examining data/zypper-1.14.11/src/main.cc Examining data/zypper-1.14.11/src/main.h Examining data/zypper-1.14.11/src/misc.h Examining data/zypper-1.14.11/src/output/AliveCursor.h Examining data/zypper-1.14.11/src/output/Out.cc Examining data/zypper-1.14.11/src/output/Out.h Examining data/zypper-1.14.11/src/output/OutNormal.cc Examining data/zypper-1.14.11/src/output/OutNormal.h Examining data/zypper-1.14.11/src/output/OutXML.cc Examining data/zypper-1.14.11/src/output/OutXML.h Examining data/zypper-1.14.11/src/output/Utf8.h Examining data/zypper-1.14.11/src/output/prompt.h Examining data/zypper-1.14.11/src/ps.cc Examining data/zypper-1.14.11/src/ps.h Examining data/zypper-1.14.11/src/repos.cc Examining data/zypper-1.14.11/src/repos.h Examining data/zypper-1.14.11/src/search.cc Examining data/zypper-1.14.11/src/search.h Examining data/zypper-1.14.11/src/solve-commit.cc Examining data/zypper-1.14.11/src/solve-commit.h Examining data/zypper-1.14.11/src/source-download.cc Examining data/zypper-1.14.11/src/source-download.h Examining data/zypper-1.14.11/src/subcommand.cc Examining data/zypper-1.14.11/src/subcommand.h Examining data/zypper-1.14.11/src/update.cc Examining data/zypper-1.14.11/src/update.h Examining data/zypper-1.14.11/src/utils/Augeas.cc Examining data/zypper-1.14.11/src/utils/Augeas.h Examining data/zypper-1.14.11/src/utils/XmlFilter.h Examining data/zypper-1.14.11/src/utils/ansi.h Examining data/zypper-1.14.11/src/utils/colors.cc Examining data/zypper-1.14.11/src/utils/colors.h Examining data/zypper-1.14.11/src/utils/console.cc Examining data/zypper-1.14.11/src/utils/console.h Examining data/zypper-1.14.11/src/utils/flags/exceptions.cc Examining data/zypper-1.14.11/src/utils/flags/exceptions.h Examining data/zypper-1.14.11/src/utils/flags/flagtypes.cc Examining data/zypper-1.14.11/src/utils/flags/flagtypes.h Examining data/zypper-1.14.11/src/utils/flags/zyppflags.cc Examining data/zypper-1.14.11/src/utils/flags/zyppflags.h Examining data/zypper-1.14.11/src/utils/getopt.cc Examining data/zypper-1.14.11/src/utils/getopt.h Examining data/zypper-1.14.11/src/utils/messages.cc Examining data/zypper-1.14.11/src/utils/messages.h Examining data/zypper-1.14.11/src/utils/misc.cc Examining data/zypper-1.14.11/src/utils/misc.h Examining data/zypper-1.14.11/src/utils/pager.cc Examining data/zypper-1.14.11/src/utils/pager.h Examining data/zypper-1.14.11/src/utils/prompt.cc Examining data/zypper-1.14.11/src/utils/prompt.h Examining data/zypper-1.14.11/src/utils/richtext.cc Examining data/zypper-1.14.11/src/utils/richtext.h Examining data/zypper-1.14.11/src/utils/text.cc Examining data/zypper-1.14.11/src/utils/text.h Examining data/zypper-1.14.11/src/zypp-refresh.cc Examining data/zypper-1.14.11/src/Zypper.cc Examining data/zypper-1.14.11/src/misc.cc Examining data/zypper-1.14.11/tests/PackageArgs_test.cc Examining data/zypper-1.14.11/tests/SolverRequester_test.cc Examining data/zypper-1.14.11/tests/lib/TestSetup.h Examining data/zypper-1.14.11/tests/utils/text_test.cc FINAL RESULTS: data/zypper-1.14.11/src/callbacks/media.cc:342:20: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. password = ::getpass( "" ); data/zypper-1.14.11/src/source-download.cc:412:29: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. repo::RepoMediaAccess access; data/zypper-1.14.11/src/source-download.cc:413:38: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. repo::SrcPackageProvider prov( access ); data/zypper-1.14.11/src/subcommand.cc:272: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. if ( ! execvp( argv[0], (char**)argv ) ) data/zypper-1.14.11/src/utils/pager.cc:67:5: [4] (shell) execlp: 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. execlp( "sh", "sh", "-c", cmdline.str().c_str(), (char *)0 ); data/zypper-1.14.11/src/Config.cc:40:22: [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. char *term = ::getenv("TERM"); data/zypper-1.14.11/src/Zypper.cc:568:25: [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 * envp = getenv( "XDG_CACHE_HOME" ); data/zypper-1.14.11/src/Zypper.cc:573:13: [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. ret = getenv( "HOME" ); data/zypper-1.14.11/src/Zypper.cc:1407:26: [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 * env = ::getenv( "ZYPP_REPO_RELEASEVER" ); data/zypper-1.14.11/src/Zypper.cc:1704:24: [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 * env = getenv("HOME"); data/zypper-1.14.11/src/Zypper.cc:4577:20: [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 *roh = getenv( "ZYPP_READONLY_HACK" ); data/zypper-1.14.11/src/main.cc:69:25: [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 *logfile = getenv("ZYPP_LOGFILE"); data/zypper-1.14.11/src/output/Utf8.h:37:24: [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 * lang = ::getenv( "LANG" ); data/zypper-1.14.11/src/subcommand.cc:34:31: [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. if ( const char * env = ::getenv("PATH") ) data/zypper-1.14.11/src/utils/Augeas.cc:38:28: [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 * env = ::getenv("PWD"); data/zypper-1.14.11/src/utils/Augeas.cc:48:26: [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 * env = ::getenv("HOME"); data/zypper-1.14.11/src/utils/console.cc:52:26: [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 *cols_env = getenv("COLUMNS"); data/zypper-1.14.11/src/utils/flags/zyppflags.cc:157:16: [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 optc = getopt_long( argc, argv, shortopts.c_str(), longopts.data(), &option_index ); data/zypper-1.14.11/src/utils/getopt.cc:61:12: [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. optc = getopt_long( argc, argv, optstring.c_str(), longopts, &option_index ); data/zypper-1.14.11/src/utils/pager.cc:120:28: [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* envpager = ::getenv("PAGER"); data/zypper-1.14.11/src/utils/pager.cc:153:28: [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* envpager = ::getenv("PAGER"); data/zypper-1.14.11/src/zypp-refresh.cc:95:25: [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 *logfile = getenv("ZYPP_LOGFILE"); data/zypper-1.14.11/src/callbacks/media.cc:115:35: [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). media::MediaAccessId mid = mm.open( url ); data/zypper-1.14.11/src/callbacks/media.cc:146:37: [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). media::MediaAccessId mid = mm.open( url ); data/zypper-1.14.11/src/subcommand.cc:266:8: [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. const char * argv[_args.size()+1]; data/zypper-1.14.11/src/utils/Augeas.cc:67: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. const char *value[1] = {}; data/zypper-1.14.11/src/utils/Augeas.cc:139: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. const char *value[1] = {}; data/zypper-1.14.11/src/utils/XmlFilter.h:234: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). bool open() const { return bool(_stream)||bool(_node); } data/zypper-1.14.11/src/utils/XmlFilter.h:236:22: [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). std::ostream & open( std::ostream & str_r, std::string name_r, bool collecting_r = true ) data/zypper-1.14.11/src/utils/XmlFilter.h:238: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). if ( open() ) throw std::logic_error("StackData::open"); data/zypper-1.14.11/src/utils/XmlFilter.h:290: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). << (obj.open()?"o":"_") data/zypper-1.14.11/src/utils/XmlFilter.h:304:17: [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). if ( data.open() ) data/zypper-1.14.11/src/utils/XmlFilter.h:310: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). data.open( getParentStream( node_r.parent() ), data/zypper-1.14.11/src/utils/XmlFilter.h:324:13: [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). ndata.open( getParentStream( top() ), std::move(name_r), /*collecting*/true ); data/zypper-1.14.11/src/utils/console.cc:54:16: [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). width = ::atoi( cols_env ); data/zypper-1.14.11/src/utils/console.cc:75: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 s[8]; data/zypper-1.14.11/src/utils/misc.cc:330:7: [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[PATH_MAX]; data/zypper-1.14.11/src/utils/misc.cc:520:35: [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). media::MediaAccessId mid = mm.open(rpmurl); data/zypper-1.14.11/src/utils/prompt.cc:166:7: [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 reply_str[2] = { reply, 0 }; data/zypper-1.14.11/src/Config.cc:214:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void Config::read( const std::string & file ) data/zypper-1.14.11/src/Config.h:28:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(const std::string & file = ""); data/zypper-1.14.11/src/Zypper.cc:1198:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). _config.read( (it = gopts.find("config")) != gopts.end() ? it->second.front() : "" ); data/zypper-1.14.11/src/Zypper.cc:6325:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). Locks::instance().read(); data/zypper-1.14.11/src/callbacks/media.cc:154:5: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/zypper-1.14.11/src/commands/locks/list.cc:266:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). locks.read( Pathname::assertprefix( zypper.globalOpts().root_dir, ZConfig::instance().locksFile() ) ); data/zypper-1.14.11/src/locks.cc:32:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). locks.read(Pathname::assertprefix data/zypper-1.14.11/src/locks.cc:91:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). locks.read(Pathname::assertprefix data/zypper-1.14.11/src/utils/flags/zyppflags.cc:194:26: [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 ( optarg && strlen(optarg) ) { data/zypper-1.14.11/src/utils/prompt.cc:165:15: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). reply = getchar(); data/zypper-1.14.11/src/utils/prompt.cc:183:23: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). do {} while ( getchar() != '\n' ); ANALYSIS SUMMARY: Hits = 50 Lines analyzed = 35332 in approximately 0.88 seconds (40273 lines/second) Physical Source Lines of Code (SLOC) = 25427 Hits@level = [0] 0 [1] 11 [2] 17 [3] 17 [4] 5 [5] 0 Hits@level+ = [0+] 50 [1+] 50 [2+] 39 [3+] 22 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 1.96641 [1+] 1.96641 [2+] 1.5338 [3+] 0.865222 [4+] 0.196641 [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.