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/xbindkeys-1.8.7/grab_key.c Examining data/xbindkeys-1.8.7/keys.c Examining data/xbindkeys-1.8.7/options.h Examining data/xbindkeys-1.8.7/xbindkeys.c Examining data/xbindkeys-1.8.7/xbindkeys.h Examining data/xbindkeys-1.8.7/grab_key.h Examining data/xbindkeys-1.8.7/keys.h Examining data/xbindkeys-1.8.7/get_key.c Examining data/xbindkeys-1.8.7/get_key.h Examining data/xbindkeys-1.8.7/options.c FINAL RESULTS: data/xbindkeys-1.8.7/keys.c:162:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:163:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[0], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:169:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:170:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[1], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:177:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:178:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[2], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:184:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:185:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[3], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:191:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:192:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[4], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:198:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:199:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[5], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:205:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, "+", STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:206:7: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat (str, modifier_string[6], STR_KEY_LEN); data/xbindkeys-1.8.7/keys.c:433:10: [4] (shell) execlp: 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. case 0: execlp ("sh", "sh", "-c", command, (char *) NULL); data/xbindkeys-1.8.7/keys.c:445: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 (command); data/xbindkeys-1.8.7/options.c:176:14: [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. home = getenv ("HOME"); data/xbindkeys-1.8.7/options.c:188:14: [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. home = getenv ("HOME"); data/xbindkeys-1.8.7/keys.c:38: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. extern char rc_file[512]; data/xbindkeys-1.8.7/keys.c:214: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 str[STR_KEY_LEN]; data/xbindkeys-1.8.7/options.c:35: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 rc_file[512]; data/xbindkeys-1.8.7/options.c:37: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 rc_guile_file[512]; data/xbindkeys-1.8.7/options.c:518:17: [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 ((stream = fopen (filename, "r")) == NULL) data/xbindkeys-1.8.7/options.c:561: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 line[1024]; data/xbindkeys-1.8.7/options.c:562: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 line2[1024]; data/xbindkeys-1.8.7/options.c:563: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 command[1024]; data/xbindkeys-1.8.7/options.c:581:17: [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 ((stream = fopen (rc_file, "r")) == NULL) data/xbindkeys-1.8.7/options.c:860:17: [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 ((stream = fopen (rc_guile_file, "r")) == NULL) data/xbindkeys-1.8.7/xbindkeys.c:55: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. extern char rc_file[512]; data/xbindkeys-1.8.7/xbindkeys.c:57: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. extern char rc_guile_file[512]; data/xbindkeys-1.8.7/xbindkeys.c:219: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[16]; data/xbindkeys-1.8.7/xbindkeys.c:556:7: [2] (misc) open: 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). i = open ("/dev/null", O_RDWR); data/xbindkeys-1.8.7/keys.c:269: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). size = (strlen (command) + 1) * sizeof (char); data/xbindkeys-1.8.7/keys.c:272:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (key->command, command, size); data/xbindkeys-1.8.7/keys.c:295: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). size = (strlen (command) + 1) * sizeof (char); data/xbindkeys-1.8.7/keys.c:298:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (key->command, command, size); data/xbindkeys-1.8.7/keys.c:322: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). size = (strlen (command) + 1) * sizeof (char); data/xbindkeys-1.8.7/keys.c:325:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (key->command, command, size); data/xbindkeys-1.8.7/options.c:77:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant character. strncpy (rc_file, "", sizeof(rc_file)); data/xbindkeys-1.8.7/options.c:79:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant character. strncpy (rc_guile_file, "", sizeof (rc_guile_file)); data/xbindkeys-1.8.7/options.c:103:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rc_file, argv[++i], sizeof (rc_file) - 1); data/xbindkeys-1.8.7/options.c:109:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rc_guile_file, argv[++i], sizeof (rc_guile_file) - 1); data/xbindkeys-1.8.7/options.c:180:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rc_file, home, sizeof (rc_file) - 20); data/xbindkeys-1.8.7/options.c:181:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat (rc_file, "/.xbindkeysrc", 20); data/xbindkeys-1.8.7/options.c:192:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (rc_guile_file, home, sizeof (rc_guile_file) - 20); data/xbindkeys-1.8.7/options.c:193:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat (rc_guile_file, "/.xbindkeysrc.scm", 20); data/xbindkeys-1.8.7/options.c:911:11: [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). len = strlen(str); data/xbindkeys-1.8.7/options.c:939: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). else if(strlen (str) > 2 && str[0] == 'm' && str[1] == ':'){ data/xbindkeys-1.8.7/options.c:962:9: [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). len = strlen(str); data/xbindkeys-1.8.7/options.c:970:6: [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 (str) > 2 && str[1] == ':' && isdigit (str[2])) data/xbindkeys-1.8.7/xbindkeys.c:215:24: [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). size_t envstr_size = strlen(DisplayString(xany->display)) + 8 + 1; data/xbindkeys-1.8.7/xbindkeys.c:233:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat (envstr, buf, 16); data/xbindkeys-1.8.7/xbindkeys.c:293:4: [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(SLEEP_TIME*1000); ANALYSIS SUMMARY: Hits = 53 Lines analyzed = 2903 in approximately 0.10 seconds (29933 lines/second) Physical Source Lines of Code (SLOC) = 2182 Hits@level = [0] 333 [1] 21 [2] 14 [3] 2 [4] 2 [5] 14 Hits@level+ = [0+] 386 [1+] 53 [2+] 32 [3+] 18 [4+] 16 [5+] 14 Hits/KSLOC@level+ = [0+] 176.902 [1+] 24.2896 [2+] 14.6654 [3+] 8.24931 [4+] 7.33272 [5+] 6.41613 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.