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/qconf-2.4/conf/conf.cpp Examining data/qconf-2.4/conf/conf4.cpp Examining data/qconf-2.4/conf/conf4.h Examining data/qconf-2.4/src/configexe/configexe.c Examining data/qconf-2.4/src/configexe/embed.c Examining data/qconf-2.4/src/configexe/embed.h Examining data/qconf-2.4/src/qconf.cpp Examining data/qconf-2.4/src/stringhelp.cpp Examining data/qconf-2.4/src/stringhelp.h FINAL RESULTS: data/qconf-2.4/src/qconf.cpp:1681:2: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. chmod("configure", 0755); data/qconf-2.4/conf/conf.cpp:170: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. int r = system(fullcmd.latin1()); data/qconf-2.4/src/configexe/configexe.c:293:2: [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(str, var); data/qconf-2.4/src/configexe/configexe.c:295:2: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(str, val); data/qconf-2.4/src/configexe/configexe.c:540:9: [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 = popen(command, "r"); data/qconf-2.4/src/configexe/configexe.c:569:8: [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. ret = system(str); data/qconf-2.4/src/configexe/configexe.c:586:8: [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. ret = system(str); data/qconf-2.4/src/configexe/configexe.c:605:8: [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. ret = system(str); data/qconf-2.4/src/configexe/configexe.c:666:8: [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. ret = system(str); data/qconf-2.4/src/configexe/configexe.c:826:8: [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. ret = system(npath); data/qconf-2.4/src/configexe/configexe.c:968: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("type conf.log"); data/qconf-2.4/conf/conf.cpp:76:10: [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. QString getenv(const QString &var) data/qconf-2.4/conf/conf.cpp:78:15: [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 *p = ::getenv(var.latin1()); data/qconf-2.4/conf/conf.cpp:96:6: [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(getenv("QC_VERBOSE") == "Y") data/qconf-2.4/conf/conf.cpp:104:8: [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(getenv(v) != "Y") data/qconf-2.4/conf/conf.cpp:110:8: [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(getenv(v) == "Y") data/qconf-2.4/conf/conf.cpp:367: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. char *p = getenv("BINDIR"); data/qconf-2.4/conf/conf4.cpp:29:14: [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 *p = ::getenv(var.toLatin1().data()); data/qconf-2.4/conf/conf4.cpp:466:15: [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. QString Conf::getenv(const QString &var) data/qconf-2.4/conf/conf4.cpp:492:7: [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(getenv(v) != "Y") data/qconf-2.4/conf/conf4.cpp:499:7: [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(getenv(v) == "Y") data/qconf-2.4/conf/conf4.cpp:771:6: [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. s = getenv(incvar); data/qconf-2.4/conf/conf4.cpp:783:6: [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. s = getenv(libvar); data/qconf-2.4/conf/conf4.h:75:10: [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. QString getenv(const QString &var); data/qconf-2.4/src/configexe/configexe.c:302:9: [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. return getenv(var); data/qconf-2.4/conf/conf.cpp:182:9: [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(!f.open(IO_WriteOnly | IO_Truncate)) { data/qconf-2.4/conf/conf.cpp:349:9: [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(!f.open(IO_WriteOnly | IO_Truncate)) { data/qconf-2.4/conf/conf4.cpp:618: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). if(!f.open(QFile::WriteOnly | QFile::Truncate)) data/qconf-2.4/conf/conf4.cpp:647: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). if(!f.open(QFile::WriteOnly | QFile::Truncate)) data/qconf-2.4/conf/conf4.cpp:1003:9: [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(!f.open(QFile::WriteOnly | QFile::Truncate)) data/qconf-2.4/src/configexe/configexe.c:89: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(out, src, len); data/qconf-2.4/src/configexe/configexe.c:126: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(out, in, at); data/qconf-2.4/src/configexe/configexe.c:127: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(out + at, sub, slen); data/qconf-2.4/src/configexe/configexe.c:128: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(out + at + slen, in + at + len, ilen - at - len); data/qconf-2.4/src/configexe/configexe.c:211: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(q->files[n].data, p, len); data/qconf-2.4/src/configexe/configexe.c:378: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 command[PATH_MAX]; data/qconf-2.4/src/configexe/configexe.c:426: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[20]; // version string output always small data/qconf-2.4/src/configexe/configexe.c:691:7: [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). fp = fopen(npath, "wb"); data/qconf-2.4/src/configexe/configexe.c:887: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[20]; // version string output always small data/qconf-2.4/src/configexe/configexe.c:910: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[32]; data/qconf-2.4/src/configexe/configexe.c:915: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 *qmake_conf, buf[1024]; data/qconf-2.4/src/configexe/configexe.c:919:10: [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). fp = fopen(qmake_conf, "r"); data/qconf-2.4/src/configexe/embed.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 hashstr[9]; data/qconf-2.4/src/configexe/embed.c:55: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(blocksig_data, BLOCKSIG_ID, idlen); data/qconf-2.4/src/configexe/embed.c:57:2: [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(hashstr, "%08x", hash); data/qconf-2.4/src/configexe/embed.c:68: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 module_name[MAX_PATH+1]; data/qconf-2.4/src/configexe/embed.c:98: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 block[8192]; data/qconf-2.4/src/configexe/embed.c:154: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 buf[4]; data/qconf-2.4/src/configexe/embed.c:161:7: [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). fp = fopen(fname, "rb"); data/qconf-2.4/src/qconf.cpp:157: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). if(!f.open(QIODevice::ReadOnly)) data/qconf-2.4/src/qconf.cpp:162:9: [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(!f.open(QIODevice::ReadOnly)) data/qconf-2.4/src/qconf.cpp:1403: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). if(!f.open(QFile::WriteOnly | QFile::Truncate)) { data/qconf-2.4/src/qconf.cpp:1451:9: [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(!f.open(QFile::ReadOnly)) { data/qconf-2.4/src/qconf.cpp:1512:9: [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(!f.open(QFile::ReadOnly)) { data/qconf-2.4/src/qconf.cpp:1521: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). if(!f.open(QFile::ReadOnly)) { data/qconf-2.4/src/qconf.cpp:1529: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). if(!f.open(QFile::ReadOnly)) { data/qconf-2.4/src/qconf.cpp:1601:11: [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(!mod.open(QFile::ReadOnly | QFile::Text)) { data/qconf-2.4/src/qconf.cpp:1623: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). if(!out.open(QFile::WriteOnly | QFile::Truncate)) { data/qconf-2.4/src/qconf.cpp:1690:11: [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(!out.open(QFile::WriteOnly | QFile::Truncate)) { data/qconf-2.4/src/configexe/configexe.c:122:9: [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). ilen = strlen(in); data/qconf-2.4/src/configexe/configexe.c:123:9: [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). slen = strlen(sub); data/qconf-2.4/src/configexe/configexe.c:139:9: [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). olen = strlen(old); data/qconf-2.4/src/configexe/configexe.c:149: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). return selection_insert(in, strlen(in), 0, add); data/qconf-2.4/src/configexe/configexe.c:292: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). str = malloc(strlen(var) + 1 + strlen(val) + 1); data/qconf-2.4/src/configexe/configexe.c:292: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). str = malloc(strlen(var) + 1 + strlen(val) + 1); data/qconf-2.4/src/configexe/configexe.c:294:2: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(str, "="); data/qconf-2.4/src/configexe/configexe.c:314:8: [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). len = strlen(in); data/qconf-2.4/src/configexe/configexe.c:1103: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 (val && strlen(val)) data/qconf-2.4/src/configexe/embed.c:52:10: [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). idlen = strlen(BLOCKSIG_ID); data/qconf-2.4/src/configexe/embed.c:105:12: [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). str_len = strlen(str); ANALYSIS SUMMARY: Hits = 70 Lines analyzed = 4835 in approximately 0.12 seconds (40497 lines/second) Physical Source Lines of Code (SLOC) = 3983 Hits@level = [0] 111 [1] 11 [2] 34 [3] 14 [4] 10 [5] 1 Hits@level+ = [0+] 181 [1+] 70 [2+] 59 [3+] 25 [4+] 11 [5+] 1 Hits/KSLOC@level+ = [0+] 45.4431 [1+] 17.5747 [2+] 14.813 [3+] 6.27668 [4+] 2.76174 [5+] 0.251067 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.