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/wmfire-1.2.4/src/flamedefault.h Examining data/wmfire-1.2.4/src/flameblue.h Examining data/wmfire-1.2.4/src/session.c Examining data/wmfire-1.2.4/src/session.h Examining data/wmfire-1.2.4/src/flamecorona.h Examining data/wmfire-1.2.4/src/flamegreen.h Examining data/wmfire-1.2.4/src/wmfire.c FINAL RESULTS: data/wmfire-1.2.4/src/wmfire.c:711:5: [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(resource_name, optarg); data/wmfire-1.2.4/src/wmfire.c:163:2: [3] (random) srand: 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. srand(time(NULL)); data/wmfire-1.2.4/src/wmfire.c:516: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. bm.cmap[(random() % XMAX) + ((YMAX - 1) * XMAX)] = random() % NCOLOURS; data/wmfire-1.2.4/src/wmfire.c:516:54: [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. bm.cmap[(random() % XMAX) + ((YMAX - 1) * XMAX)] = random() % NCOLOURS; data/wmfire-1.2.4/src/wmfire.c:518: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. bm.cmap[(random() % XMAX) + ((YMAX - 1) * XMAX)] = bm.cmap[i + ((YMAX - 1) * XMAX)] >> 1; data/wmfire-1.2.4/src/wmfire.c:675:14: [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 ((i = getopt(argc, argv, "c:mni:r:s:xF:H:L:pf:lbhg:yS:")) != -1) { data/wmfire-1.2.4/src/flameblue.h:3:17: [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 unsigned char flameblue[256*3+1] = { data/wmfire-1.2.4/src/flamecorona.h:3:17: [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 unsigned char flamecorona[256*3+1] = { data/wmfire-1.2.4/src/flamedefault.h:3:17: [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 unsigned char flamedefault[256*3+1] = { data/wmfire-1.2.4/src/flamegreen.h:3:17: [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 unsigned char flamegreen[256*3+1] = { data/wmfire-1.2.4/src/session.c:112: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(pid_str, "%i", getpid()); data/wmfire-1.2.4/src/wmfire.c:93: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 cmap[CMAPSIZE]; data/wmfire-1.2.4/src/wmfire.c:94: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 rgb[RGBSIZE]; data/wmfire-1.2.4/src/wmfire.c:139: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 net_dev[16] = "ppp0"; data/wmfire-1.2.4/src/wmfire.c:140: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 resource_name[64] = "wmfire"; data/wmfire-1.2.4/src/wmfire.c:396: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[128]; data/wmfire-1.2.4/src/wmfire.c:400: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(file_name, "r"))) data/wmfire-1.2.4/src/wmfire.c:581: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(&bm.rgb[i * 3], &bm.flame[bm.cmap[i] * 3], 3); data/wmfire-1.2.4/src/wmfire.c:697: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). change_cpu(atoi(optarg)); data/wmfire-1.2.4/src/wmfire.c:715:15: [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). net_spd = atoi(optarg); data/wmfire-1.2.4/src/wmfire.c:742:18: [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). change_flame(atoi(optarg)); data/wmfire-1.2.4/src/session.c:106:22: [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). userid_val.length = strlen(userid_str); data/wmfire-1.2.4/src/session.c:114:19: [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). pid_val.length = strlen(pid_str); data/wmfire-1.2.4/src/session.c:123: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). restart.vals[j++].length = strlen(argv[i]); data/wmfire-1.2.4/src/session.c:130:29: [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). restart.vals[j++].length = strlen(client_id); data/wmfire-1.2.4/src/wmfire.c:265: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(REFRESH); data/wmfire-1.2.4/src/wmfire.c:707:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(net_dev, optarg, sizeof (net_dev)); ANALYSIS SUMMARY: Hits = 27 Lines analyzed = 1112 in approximately 0.04 seconds (25563 lines/second) Physical Source Lines of Code (SLOC) = 796 Hits@level = [0] 24 [1] 6 [2] 15 [3] 5 [4] 1 [5] 0 Hits@level+ = [0+] 51 [1+] 27 [2+] 21 [3+] 6 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 64.0704 [1+] 33.9196 [2+] 26.3819 [3+] 7.53769 [4+] 1.25628 [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.