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/miwm-1.1/EKeyValueParser.cc Examining data/miwm-1.1/EKeyValueParser.h Examining data/miwm-1.1/EPathFinder.cc Examining data/miwm-1.1/EPathFinder.h Examining data/miwm-1.1/EPropertyList.cc Examining data/miwm-1.1/EPropertyList.h Examining data/miwm-1.1/EShellProcess.cc Examining data/miwm-1.1/EShellProcess.h Examining data/miwm-1.1/ESimpleCLParser.h Examining data/miwm-1.1/EStdStringTokenizer.cc Examining data/miwm-1.1/EStdStringTokenizer.h Examining data/miwm-1.1/EStringList.cc Examining data/miwm-1.1/EStringList.h Examining data/miwm-1.1/EStringTokenizer.h Examining data/miwm-1.1/alpha.cc Examining data/miwm-1.1/alpha.h Examining data/miwm-1.1/client.cc Examining data/miwm-1.1/client.h Examining data/miwm-1.1/cursor.cc Examining data/miwm-1.1/disp.cc Examining data/miwm-1.1/menu.cc Examining data/miwm-1.1/miconfig.h Examining data/miwm-1.1/mimenu.h Examining data/miwm-1.1/mipix.cc Examining data/miwm-1.1/mipix.h Examining data/miwm-1.1/miwm_framework.cc Examining data/miwm-1.1/miwm_framework.h Examining data/miwm-1.1/mlchckr.h Examining data/miwm-1.1/mouse.cc Examining data/miwm-1.1/nodes.cc Examining data/miwm-1.1/nodes.h Examining data/miwm-1.1/null.cc Examining data/miwm-1.1/null.h Examining data/miwm-1.1/resource.cc Examining data/miwm-1.1/rng.cc Examining data/miwm-1.1/rng.h Examining data/miwm-1.1/shape.cc Examining data/miwm-1.1/struct.h Examining data/miwm-1.1/version.h Examining data/miwm-1.1/ws.h Examining data/miwm-1.1/ESimpleCLParser.cc Examining data/miwm-1.1/mlchckr.cc Examining data/miwm-1.1/wspace.cc Examining data/miwm-1.1/EStringTokenizer.cc Examining data/miwm-1.1/miwm.h Examining data/miwm-1.1/ops.cc Examining data/miwm-1.1/wm.cc Examining data/miwm-1.1/error.cc Examining data/miwm-1.1/manage.cc Examining data/miwm-1.1/miwm.cc FINAL RESULTS: data/miwm-1.1/EPathFinder.cc:133:27: [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. int err = access( path.c_str(), R_OK ); data/miwm-1.1/EShellProcess.cc:24:16: [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. EShellProcess::system( const std::string &cmdline, std::ostream & os ) data/miwm-1.1/EShellProcess.cc:26:18: [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. return ::system( cmdline.c_str() ) / 256; // i don't like this /256. it's against the docs, but the return values aren't what the docs say :/ data/miwm-1.1/EShellProcess.cc:79:9: [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( filearg.c_str(), args ); data/miwm-1.1/EShellProcess.cc:93:16: [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( cmdline.c_str(), "r" ); data/miwm-1.1/EShellProcess.h:46:13: [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. int system( const std::string &, std::ostream & os = std::cout ); data/miwm-1.1/ops.cc:264:5: [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. execl(sh, sh, "-c", "miwm", 0); data/miwm-1.1/resource.cc:61:10: [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). return strcpy(s, p); data/miwm-1.1/wm.cc:390:5: [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. execl(sh, sh, "-c", command, 0); data/miwm-1.1/EPathFinder.h:127:40: [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. BinPathFinder() : EPathFinder( getenv( "PATH" ) ) {}; data/miwm-1.1/miwm_framework.cc:14:37: [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 * hp = ::getenv( "HOME" ); data/miwm-1.1/miwm_framework.cc:21:40: [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. hp = ::getenv( "TEMP" ); data/miwm-1.1/ops.cc:255:23: [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* sh = ((char*) getenv("SHELL")); data/miwm-1.1/wm.cc:378:23: [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* sh = ((char*) getenv("SHELL")); data/miwm-1.1/EPropertyList.cc:202:5: [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( this->number_buffer, "%d", defaultVal ); data/miwm-1.1/EPropertyList.cc:204:12: [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). return atoi( s.c_str() ); data/miwm-1.1/EPropertyList.cc:213:5: [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( this->number_buffer, "%d", val ); data/miwm-1.1/EPropertyList.cc:244:5: [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( this->number_buffer, "%f", defaultVal ); data/miwm-1.1/EPropertyList.cc:256:5: [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( this->number_buffer, "%f", val ); data/miwm-1.1/EShellProcess.cc:48: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. char * args[maxargs]; data/miwm-1.1/ESimpleCLParser.cc:99:27: [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. a = std::string ((const char *) argv[i]); data/miwm-1.1/ESimpleCLParser.cc:162: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 *cargs[maxargs]; // max number of arguments. This size is completely arbitrary. data/miwm-1.1/client.cc:213: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[4*2 + 3 +1]; data/miwm-1.1/client.cc:216: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, "%i , %i", c->rX, c->rY - titleHeightc(c)); data/miwm-1.1/client.cc:225: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[4*2 + 3 +1]; data/miwm-1.1/client.cc:250: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, "%i x %i", width, height); data/miwm-1.1/error.cc:54: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 msg[80]; data/miwm-1.1/error.cc:55: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 req[80]; data/miwm-1.1/error.cc:56: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 number[80]; data/miwm-1.1/error.cc:68: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(number, "%d", e->request_code); data/miwm-1.1/EShellProcess.cc:108:38: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getcchar = ::getc( fp ); data/miwm-1.1/ESimpleCLParser.cc:170:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (cargs[count], toker.nextToken (), argbufsize); data/miwm-1.1/EStringTokenizer.cc:34: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). int strLength = strlen( str ) + 1; data/miwm-1.1/EStringTokenizer.cc:83: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). pos += strlen( ret ) + 1; data/miwm-1.1/client.cc:218:42: [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). (80 - XTextWidth(popup_font, buf, strlen(buf))) / 2, data/miwm-1.1/client.cc:219:37: [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). popup_font->ascent + 1, buf, strlen(buf)); data/miwm-1.1/client.cc:252:42: [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). (80 - XTextWidth(popup_font, buf, strlen(buf))) / 2, data/miwm-1.1/client.cc:253:37: [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). popup_font->ascent + 1, buf, strlen(buf)); data/miwm-1.1/client.cc:475:42: [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). font->ascent + font->descent, c->name, strlen(c->name)); data/miwm-1.1/resource.cc:58: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). s = new char[ sizeof(char) * (strlen(p) + 1) ]; ANALYSIS SUMMARY: Hits = 40 Lines analyzed = 10413 in approximately 0.21 seconds (49488 lines/second) Physical Source Lines of Code (SLOC) = 5899 Hits@level = [0] 7 [1] 10 [2] 16 [3] 5 [4] 9 [5] 0 Hits@level+ = [0+] 47 [1+] 40 [2+] 30 [3+] 14 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 7.96745 [1+] 6.78081 [2+] 5.08561 [3+] 2.37328 [4+] 1.52568 [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.