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/wmctrl-1.07/main.c FINAL RESULTS: data/wmctrl-1.07/main.c:186:5: [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. fprintf(stderr, __VA_ARGS__); \ data/wmctrl-1.07/main.c:267:19: [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 ((opt = getopt(argc, argv, "FGVvhlupidmxa:r:s:c:t:w:k:o:n:g:e:b:N:I:T:R:")) != -1) { data/wmctrl-1.07/main.c:392:19: [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. gchar *lang = getenv("LANG") ? g_ascii_strup(getenv("LANG"), -1) : NULL; data/wmctrl-1.07/main.c:392:50: [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. gchar *lang = getenv("LANG") ? g_ascii_strup(getenv("LANG"), -1) : NULL; data/wmctrl-1.07/main.c:393: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. gchar *lc_ctype = getenv("LC_CTYPE") ? g_ascii_strup(getenv("LC_CTYPE"), -1) : NULL; data/wmctrl-1.07/main.c:393:58: [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. gchar *lc_ctype = getenv("LC_CTYPE") ? g_ascii_strup(getenv("LC_CTYPE"), -1) : NULL; data/wmctrl-1.07/main.c:621: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). target = atoi(options.param); data/wmctrl-1.07/main.c:896:49: [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 window_to_desktop(disp, win, atoi(options.param)); data/wmctrl-1.07/main.c:1457: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(ret, ret_prop, tmp_size); data/wmctrl-1.07/main.c:651:34: [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). title_local, strlen(title_local)); data/wmctrl-1.07/main.c:658: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). title_utf8, strlen(title_utf8)); data/wmctrl-1.07/main.c:665:34: [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). title_local, strlen(title_local)); data/wmctrl-1.07/main.c:672: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). title_utf8, strlen(title_utf8)); data/wmctrl-1.07/main.c:744: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). if (!arg || strlen(arg) == 0) { data/wmctrl-1.07/main.c:775: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). if (strlen(p2) == 0) { data/wmctrl-1.07/main.c:787:13: [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(p1) == 0) { data/wmctrl-1.07/main.c:835: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). if (!arg || strlen(arg) == 0) { data/wmctrl-1.07/main.c:901:17: [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(100000); /* 100 ms - make sure the WM has enough data/wmctrl-1.07/main.c:1252:13: [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(strv[i]) > max) { data/wmctrl-1.07/main.c:1253: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). max = strlen(strv[i]); data/wmctrl-1.07/main.c:1293:38: [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). max_client_machine_len = strlen(client_machine); ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 1539 in approximately 0.07 seconds (22856 lines/second) Physical Source Lines of Code (SLOC) = 1268 Hits@level = [0] 22 [1] 12 [2] 3 [3] 5 [4] 1 [5] 0 Hits@level+ = [0+] 43 [1+] 21 [2+] 9 [3+] 6 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 33.9117 [1+] 16.5615 [2+] 7.09779 [3+] 4.73186 [4+] 0.788644 [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.