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/slim-1.3.6/Ck.cpp Examining data/slim-1.3.6/Ck.h Examining data/slim-1.3.6/PAM.cpp Examining data/slim-1.3.6/PAM.h Examining data/slim-1.3.6/app.h Examining data/slim-1.3.6/cfg.h Examining data/slim-1.3.6/const.h Examining data/slim-1.3.6/image.cpp Examining data/slim-1.3.6/image.h Examining data/slim-1.3.6/jpeg.c Examining data/slim-1.3.6/log.cpp Examining data/slim-1.3.6/log.h Examining data/slim-1.3.6/main.cpp Examining data/slim-1.3.6/numlock.cpp Examining data/slim-1.3.6/numlock.h Examining data/slim-1.3.6/panel.cpp Examining data/slim-1.3.6/panel.h Examining data/slim-1.3.6/png.c Examining data/slim-1.3.6/slimlock.cpp Examining data/slim-1.3.6/switchuser.cpp Examining data/slim-1.3.6/switchuser.h Examining data/slim-1.3.6/util.cpp Examining data/slim-1.3.6/util.h Examining data/slim-1.3.6/cfg.cpp Examining data/slim-1.3.6/app.cpp FINAL RESULTS: data/slim-1.3.6/app.cpp:483:14: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. encrypted = crypt(LoginPanel->GetPasswd().c_str(), correct); data/slim-1.3.6/app.cpp:535: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(pw->pw_shell, getusershell()); data/slim-1.3.6/app.cpp:635: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(sessStart.c_str()); data/slim-1.3.6/app.cpp:660: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(sessStop.c_str()); data/slim-1.3.6/app.cpp:720:2: [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(cfg->getOption("reboot_cmd").c_str()); data/slim-1.3.6/app.cpp:742:2: [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(cfg->getOption("halt_cmd").c_str()); data/slim-1.3.6/app.cpp:748:2: [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(cfg->getOption("suspend_cmd").c_str()); data/slim-1.3.6/app.cpp:763:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(tmp, cmd, width, height, posx, posy, fontx, fonty); data/slim-1.3.6/app.cpp:764:2: [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(tmp); data/slim-1.3.6/app.cpp:905: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(args, argOption.c_str()); data/slim-1.3.6/app.cpp:951:3: [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(server[0], server); data/slim-1.3.6/app.cpp:1229: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(tmp, str1); data/slim-1.3.6/app.cpp:1230: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(tmp, str2); data/slim-1.3.6/cfg.cpp:312:7: [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. access(strFile.c_str(), R_OK) == 0){ data/slim-1.3.6/cfg.cpp:329:19: [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. } else if (access(strFile.c_str(), X_OK) == 0) { data/slim-1.3.6/panel.cpp:549: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(cfg->getOption("screenshot_cmd").c_str()); data/slim-1.3.6/slimlock.cpp:70:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, errstr, ap); data/slim-1.3.6/switchuser.cpp:49:2: [4] (shell) execle: 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. execle(Pw->pw_shell, Pw->pw_shell, "-c", cmd, NULL, env); data/slim-1.3.6/util.cpp:29:7: [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. fp = popen(cmd.c_str(), "w"); data/slim-1.3.6/PAM.cpp:261:29: [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* Authenticator::getenv(const std::string& key){ data/slim-1.3.6/PAM.h:88: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. const char* getenv(const std::string& key); data/slim-1.3.6/app.cpp:147:15: [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((tmp = getopt(argc, argv, "vhp:n:d?")) != EOF) { data/slim-1.3.6/app.cpp:194:12: [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("DISPLAY"); data/slim-1.3.6/app.cpp:540: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* term = getenv("TERM"); data/slim-1.3.6/app.cpp:1166:8: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. Util::srandom(Util::makeseed()); data/slim-1.3.6/app.cpp:1172:19: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int sel = Util::random() % themes.size(); data/slim-1.3.6/app.cpp:1209:8: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. Util::srandom(Util::makeseed()); data/slim-1.3.6/app.cpp:1211:16: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. word = Util::random() & 0xffff; data/slim-1.3.6/panel.cpp:203:11: [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. SetName(getenv("USER")); data/slim-1.3.6/slimlock.cpp:141: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 *display = getenv("DISPLAY"); data/slim-1.3.6/slimlock.cpp:322:8: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. Util::srandom(Util::makeseed()); data/slim-1.3.6/slimlock.cpp:328:19: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. int sel = Util::random() % themes.size(); data/slim-1.3.6/util.cpp:44:12: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void Util::srandom(unsigned long seed) data/slim-1.3.6/util.cpp:46:4: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. ::srandom(seed); data/slim-1.3.6/util.cpp:49:12: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. long Util::random(void) data/slim-1.3.6/util.cpp:51:11: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. return ::random(); data/slim-1.3.6/util.h:18:7: [3] (random) srandom: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void srandom(unsigned long seed); data/slim-1.3.6/util.h:19:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. long random(void); data/slim-1.3.6/Ck.cpp:50: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. static char device[32]; data/slim-1.3.6/app.cpp:496: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 cursordata[1]; data/slim-1.3.6/app.cpp:596: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(child_env, old_env, sizeof(char*)*n); data/slim-1.3.6/cfg.cpp:227: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 host[40]; data/slim-1.3.6/cfg.cpp:236: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 domain[40]; data/slim-1.3.6/image.cpp:41: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(rgb_data, rgb, 3 * area); data/slim-1.3.6/image.cpp:47: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(png_alpha, alpha, area); data/slim-1.3.6/image.cpp:58: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[4]; data/slim-1.3.6/image.cpp:63: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). file = fopen(filename, "rb"); data/slim-1.3.6/image.cpp:216: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 *pixels[4]; data/slim-1.3.6/image.cpp:229: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. unsigned char pixels[4]; data/slim-1.3.6/image.cpp:311: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(new_rgb, bg_rgb, 3 * bg_w * bg_h); data/slim-1.3.6/image.cpp:725:17: [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). FILE *infile = fopen(filename, "rb"); data/slim-1.3.6/image.cpp:814:17: [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). FILE *infile = fopen(filename, "rb"); data/slim-1.3.6/image.cpp:917:4: [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(ptr, row_pointers[i], 3 * (*width)); data/slim-1.3.6/jpeg.c:36:17: [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). FILE *infile = fopen(filename, "rb"); data/slim-1.3.6/log.cpp:13: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). logFile.open(filename, ios_base::app); data/slim-1.3.6/png.c:45:17: [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). FILE *infile = fopen(filename, "rb"); data/slim-1.3.6/png.c:140:4: [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(ptr, row_pointers[i], 3 * *width); data/slim-1.3.6/slimlock.cpp:95: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). lock_file = open("/run/lock/"APPNAME".lock", O_CREAT | O_RDWR, 0666); data/slim-1.3.6/slimlock.cpp:97: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). lock_file = open("/var/lock/"APPNAME".lock", O_CREAT | O_RDWR, 0666); data/slim-1.3.6/slimlock.cpp:191: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). if ((term = open("/dev/console", O_RDWR)) == -1) data/slim-1.3.6/slimlock.cpp:266: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 cursordata[1]; data/slim-1.3.6/app.cpp:762:23: [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). char *tmp = new char[strlen(cmd) + 60]; data/slim-1.3.6/app.cpp:1228:23: [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). char* tmp = new char[strlen(str1) + strlen(str2) + 1]; data/slim-1.3.6/app.cpp:1228:38: [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). char* tmp = new char[strlen(str1) + strlen(str2) + 1]; data/slim-1.3.6/panel.cpp:411:46: [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). XftTextExtents8(Dpy, font, (XftChar8*)txth, strlen(txth), &extents); data/slim-1.3.6/panel.cpp:414:46: [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). XftTextExtents8(Dpy, font, (XftChar8*)text, strlen(text), &extents); data/slim-1.3.6/panel.cpp:652:46: [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). reinterpret_cast<const XftChar8*>(txth), strlen(txth), &extents); data/slim-1.3.6/panel.cpp:694:6: [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). strlen(welcome_message.c_str()), &extents); data/slim-1.3.6/panel.cpp:714:7: [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). strlen(msg.c_str()), &extents); data/slim-1.3.6/panel.cpp:730:7: [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). strlen(msg.c_str()), &extents); data/slim-1.3.6/slimlock.cpp:174:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000); ANALYSIS SUMMARY: Hits = 71 Lines analyzed = 5618 in approximately 0.21 seconds (27160 lines/second) Physical Source Lines of Code (SLOC) = 4294 Hits@level = [0] 18 [1] 10 [2] 23 [3] 19 [4] 19 [5] 0 Hits@level+ = [0+] 89 [1+] 71 [2+] 61 [3+] 38 [4+] 19 [5+] 0 Hits/KSLOC@level+ = [0+] 20.7266 [1+] 16.5347 [2+] 14.2059 [3+] 8.84956 [4+] 4.42478 [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.