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/wmnut-0.66/src/wmnut.h Examining data/wmnut-0.66/src/rcfiles.c Examining data/wmnut-0.66/src/wmgeneral.c Examining data/wmnut-0.66/src/wmnut.c Examining data/wmnut-0.66/src/compat.c Examining data/wmnut-0.66/src/wmgeneral.h FINAL RESULTS: data/wmnut-0.66/src/rcfiles.c:44: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(key->label, label); data/wmnut-0.66/src/rcfiles.c:150:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(home_file, "%s/%s", p, RC_FILE); data/wmnut-0.66/src/wmgeneral.c:100:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fullname, "%s:%s", wname, name); data/wmnut-0.66/src/wmnut.c:73:39: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEBUGOUT(...) { if (Verbose) fprintf(stdout, __VA_ARGS__); } data/wmnut-0.66/src/wmnut.c:74:39: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DEBUGERR(...) { if (Verbose) fprintf(stderr, __VA_ARGS__); } data/wmnut-0.66/src/wmnut.c:120: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(value, answer[3]); data/wmnut-0.66/src/wmnut.c:675:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(newhostname, "%s@%s", answer[1], hostname); data/wmnut-0.66/src/rcfiles.c:149: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. p = getenv("HOME"); data/wmnut-0.66/src/rcfiles.c:180:29: [3] (buffer) getopt_long: 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. #define GETOPTFUNC(x,y,z) getopt_long(x,y,"-" z, long_options, NULL) data/wmnut-0.66/src/rcfiles.c:183:29: [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. #define GETOPTFUNC(x,y,z) getopt(x,y,z) data/wmnut-0.66/src/rcfiles.c:75: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 temp[128]; data/wmnut-0.66/src/rcfiles.c:80: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(filename, "r"); data/wmnut-0.66/src/rcfiles.c:119:34: [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). *keys[key].var.integer = atoi(p); data/wmnut-0.66/src/rcfiles.c:140: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 home_file[128]; data/wmnut-0.66/src/rcfiles.c:209:21: [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). CriticalLevel = atoi(optarg); data/wmnut-0.66/src/rcfiles.c:212: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). LowLevel = atoi(optarg); data/wmnut-0.66/src/rcfiles.c:232: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). Volume = atoi(optarg); data/wmnut-0.66/src/wmnut.c:83:8: [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. const char *query[4]; data/wmnut-0.66/src/wmnut.c:130: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 value[SMALLBUF]; data/wmnut-0.66/src/wmnut.c:157:34: [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). CurHost->battery_percentage = atoi(value); data/wmnut-0.66/src/wmnut.c:169:31: [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). CurHost->battery_runtime = atoi(value); data/wmnut-0.66/src/wmnut.c:181:28: [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). CurHost->battery_load = atoi(value); data/wmnut-0.66/src/wmnut.c:539: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 vars[LARGEBUF]; data/wmnut-0.66/src/wmnut.c:541:8: [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. const char *query[4]; data/wmnut-0.66/src/wmnut.c:634:8: [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. const char *query[4]; data/wmnut-0.66/src/wmnut.c:637: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 newhostname[32]; data/wmnut-0.66/src/rcfiles.c:43: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). key->label = (char *)malloc(strlen(label) + 1); data/wmnut-0.66/src/rcfiles.c:91: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). p += strlen(keys[key].label); data/wmnut-0.66/src/rcfiles.c:99: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(keys[key].label) <12)?"\t\t":"\t"), p); data/wmnut-0.66/src/wmgeneral.c:97: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). fullname = (char *)malloc(strlen(name) + strlen(wname) + 3); data/wmnut-0.66/src/wmgeneral.c:97:44: [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). fullname = (char *)malloc(strlen(name) + strlen(wname) + 3); data/wmnut-0.66/src/wmgeneral.c:511: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(500L); data/wmnut-0.66/src/wmnut.c:532: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(DELAY); data/wmnut-0.66/src/wmnut.c:598: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). if (strlen(vars) == 0) { ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 1787 in approximately 0.06 seconds (29704 lines/second) Physical Source Lines of Code (SLOC) = 1069 Hits@level = [0] 37 [1] 8 [2] 16 [3] 3 [4] 7 [5] 0 Hits@level+ = [0+] 71 [1+] 34 [2+] 26 [3+] 10 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 66.4172 [1+] 31.8054 [2+] 24.3218 [3+] 9.35454 [4+] 6.54818 [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.