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/wmbutton-0.7.1/wmb_libs.c Examining data/wmbutton-0.7.1/wmbutton.c Examining data/wmbutton-0.7.1/wmbutton.h FINAL RESULTS: data/wmbutton-0.7.1/wmb_libs.c:76:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Config.configfile, "%s%s", Home, CONFFILENAME); data/wmbutton-0.7.1/wmb_libs.c:84:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Config.buttonfile, "%s%s", Home, BUTTONFILENAME); data/wmbutton-0.7.1/wmb_libs.c:188:3: [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(cmndstr); /* if there's a command, run it */ data/wmbutton-0.7.1/wmb_libs.c:388:3: [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(RetStr, StartPtr); data/wmbutton-0.7.1/wmb_libs.c:418:3: [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, tmp2); data/wmbutton-0.7.1/wmb_libs.c:424:3: [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, tmp2); data/wmbutton-0.7.1/wmb_libs.c:430:3: [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, tmp2); data/wmbutton-0.7.1/wmbutton.c:538:6: [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. if (access(Config.buttonfile, R_OK) == 0) { data/wmbutton-0.7.1/wmb_libs.c:34: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 *Home = getenv("HOME"); data/wmbutton-0.7.1/wmb_libs.c:36:26: [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 (-1 != (current = getopt(argc, argv, "vhnmsF:b:g:d:f:"))) { data/wmbutton-0.7.1/wmb_libs.c:203:12: [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). if ((fp = fopen(path, "r")) == NULL) data/wmbutton-0.7.1/wmb_libs.c:219: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[BUFFER_SIZE]; data/wmbutton-0.7.1/wmb_libs.c:222:12: [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). if ((fp = fopen(Config.configfile, "r")) == NULL) data/wmbutton-0.7.1/wmb_libs.c:223:13: [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). if ((fp = fopen(CONFIGGLOBAL, "r")) == NULL) data/wmbutton-0.7.1/wmb_libs.c:227:7: [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). if (atoi(Buf) == app) data/wmbutton-0.7.1/wmb_libs.c:396: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(RetStr, "| "); data/wmbutton-0.7.1/wmb_libs.c:74:31: [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). Config.configfile = malloc(strlen(Home) + data/wmbutton-0.7.1/wmb_libs.c:75: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). strlen(CONFFILENAME) + 1); data/wmbutton-0.7.1/wmb_libs.c:82:31: [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). Config.buttonfile = malloc(strlen(Home) + data/wmbutton-0.7.1/wmb_libs.c:83: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). strlen(BUTTONFILENAME) + 1); data/wmbutton-0.7.1/wmb_libs.c:373:18: [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). RetStr = malloc(strlen(old) + 3 + 1); /* 3 for Seperator */ data/wmbutton-0.7.1/wmb_libs.c:389:3: [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(RetStr, " "); data/wmbutton-0.7.1/wmb_libs.c:476:41: [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). nWidth = XTextWidth(_fTooltip, szText, strlen(szText)) + 16; data/wmbutton-0.7.1/wmb_libs.c:524: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). szText, strlen(szText)); data/wmbutton-0.7.1/wmbutton.c:392: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(50000); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 1428 in approximately 0.05 seconds (27791 lines/second) Physical Source Lines of Code (SLOC) = 1002 Hits@level = [0] 55 [1] 9 [2] 6 [3] 2 [4] 8 [5] 0 Hits@level+ = [0+] 80 [1+] 25 [2+] 16 [3+] 10 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 79.8403 [1+] 24.9501 [2+] 15.9681 [3+] 9.98004 [4+] 7.98403 [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.