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/flwm-1.02+git2015.10.03+7dbb30/Hotkeys.C Examining data/flwm-1.02+git2015.10.03+7dbb30/Frame.H Examining data/flwm-1.02+git2015.10.03+7dbb30/Desktop.H Examining data/flwm-1.02+git2015.10.03+7dbb30/FrameWindow.H Examining data/flwm-1.02+git2015.10.03+7dbb30/Desktop.C Examining data/flwm-1.02+git2015.10.03+7dbb30/config.h Examining data/flwm-1.02+git2015.10.03+7dbb30/FrameWindow.C Examining data/flwm-1.02+git2015.10.03+7dbb30/main.C Examining data/flwm-1.02+git2015.10.03+7dbb30/Menu.C Examining data/flwm-1.02+git2015.10.03+7dbb30/Frame.C FINAL RESULTS: data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:264:30: [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. if (name == xtermname) execlp(name, name, "-ut", (void*)0); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:265:12: [4] (shell) execl: 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. else execl(name, name, (void*)0); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:332:7: [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(path+pathlen, ent->d_name); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:341:7: [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(wmxbuffer+bufindex, path); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:402: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(path, home); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:400: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* home=getenv("HOME"); if (!home) home = "."; data/flwm-1.02+git2015.10.03+7dbb30/Desktop.C:48: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 buffer[1025]; data/flwm-1.02+git2015.10.03+7dbb30/Desktop.C:110: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[20]; sprintf(buf, "Desktop %d", n); data/flwm-1.02+git2015.10.03+7dbb30/Desktop.C:110:19: [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. char buf[20]; sprintf(buf, "Desktop %d", n); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:96: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[256]; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:196: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[120]; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:197:3: [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(buf, "Desktop %d", Desktop::available_number()); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:208: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[120]; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:210:3: [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(buf, "Desktop %d", i); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:401: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 path[1024]; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:404:3: [2] (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 string. strcat(path, ".wmx/"); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:407:5: [2] (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). Risk is low because the source is a constant string. strcpy(path, "/var/lib/flwm/wmx/"); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:420:19: [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. wmxlist = new char *[num_wmx]; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:651:5: [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(menu+n, other_menu_items+1, sizeof(other_menu_items)-sizeof(Fl_Menu_Item)); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:655:5: [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(menu+n, other_menu_items, sizeof(other_menu_items)); data/flwm-1.02+git2015.10.03+7dbb30/main.C:27: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 buf1[128], buf2[128]; data/flwm-1.02+git2015.10.03+7dbb30/main.C:28:3: [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(buf1, "XRequest.%d", e->request_code); data/flwm-1.02+git2015.10.03+7dbb30/main.C:170:1: [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 clock_buf[80]; data/flwm-1.02+git2015.10.03+7dbb30/main.C:354:14: [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). cursor = atoi(v); data/flwm-1.02+git2015.10.03+7dbb30/main.C:357:17: [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). int visid = atoi(v); data/flwm-1.02+git2015.10.03+7dbb30/main.C:366:20: [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). max_w_switch = atoi(v); data/flwm-1.02+git2015.10.03+7dbb30/main.C:368:20: [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). max_h_switch = atoi(v); data/flwm-1.02+git2015.10.03+7dbb30/Hotkeys.C:164:7: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (mismatch&(FL_META|FL_ALT|FL_CTRL)) return 0; data/flwm-1.02+git2015.10.03+7dbb30/Hotkeys.C:169:9: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (!(mismatch&(FL_SHIFT)) && unsigned(key) == Fl::event_key()) return 1; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:326:17: [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). int pathlen = strlen (path); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:334:25: [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). int len = pathlen+strlen(ent->d_name); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:345:2: [1] (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). Risk is low because the source is a constant character. strcpy(path+len, "/"); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:403: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). if (path[strlen(path)-1] != '/') strcat(path, "/"); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:403:36: [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. if (path[strlen(path)-1] != '/') strcat(path, "/"); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:413:17: [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). wmx_pathlen = strlen(path); data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:427:14: [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). cmd += strlen(cmd+1)+2; data/flwm-1.02+git2015.10.03+7dbb30/Menu.C:640:21: [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). pathlen[++level] = strlen(cmd)+1; // extra for next trailing / ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 3799 in approximately 0.11 seconds (33070 lines/second) Physical Source Lines of Code (SLOC) = 2926 Hits@level = [0] 3 [1] 10 [2] 21 [3] 1 [4] 5 [5] 0 Hits@level+ = [0+] 40 [1+] 37 [2+] 27 [3+] 6 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 13.6705 [1+] 12.6452 [2+] 9.22761 [3+] 2.05058 [4+] 1.70882 [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.