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/esekeyd-1.2.7/version.h Examining data/esekeyd-1.2.7/src/esekeyd.c Examining data/esekeyd-1.2.7/src/input.c Examining data/esekeyd-1.2.7/src/parser.c Examining data/esekeyd-1.2.7/src/esekey.h Examining data/esekeyd-1.2.7/src/keytest.c Examining data/esekeyd-1.2.7/src/learnkeys.c Examining data/esekeyd-1.2.7/src/mkparser.c FINAL RESULTS: data/esekeyd-1.2.7/src/esekeyd.c:61:17: [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 (keys[i].command); data/esekeyd-1.2.7/src/esekeyd.c:114:10: [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. if (!access(pid_name, R_OK)) data/esekeyd-1.2.7/src/esekeyd.c:300:21: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (keys_buff, KEY_SEPARATOR); data/esekeyd-1.2.7/src/esekeyd.c:326:21: [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 (keys[i].command); data/esekeyd-1.2.7/src/input.c:31:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf (buff, "N: Number=%hu Name=%s Minor=%hu", &number, name, &minor); data/esekeyd-1.2.7/src/mkparser.c:46:9: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf (buff, "#define KEY_%s %i", name, &value); data/esekeyd-1.2.7/src/esekeyd.c:116:23: [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 ((pid_fp = fopen(pid_name, "r" ))) data/esekeyd-1.2.7/src/esekeyd.c:150:14: [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 (argv[1], "r"); data/esekeyd-1.2.7/src/esekeyd.c:178:17: [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 (keys[keycount].command, separator + 1, read - (separator - buff)); data/esekeyd-1.2.7/src/esekeyd.c:196:17: [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 (keys[keycount].name, buff, separator - buff + 1); data/esekeyd-1.2.7/src/esekeyd.c:248:20: [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 (!(funkey = fopen (device_name, "r"))) data/esekeyd-1.2.7/src/esekeyd.c:274:27: [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 ((pid_fp = fopen(pid_name, "w"))) data/esekeyd-1.2.7/src/input.c:18:10: [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 (INPUT_HANDLERS, "r"); data/esekeyd-1.2.7/src/input.c:25: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 name[128]; data/esekeyd-1.2.7/src/input.c:53:10: [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 (INPUT_DEVICES, "r"); data/esekeyd-1.2.7/src/keytest.c:90:20: [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 (!(funkey = fopen (device_name, "r"))) data/esekeyd-1.2.7/src/learnkeys.c:102:20: [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 (!(funkey = fopen (device_name, "r"))) data/esekeyd-1.2.7/src/learnkeys.c:108:20: [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 (!(config = fopen (argv[1], "w"))) data/esekeyd-1.2.7/src/mkparser.c:23:5: [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 name[128]; data/esekeyd-1.2.7/src/mkparser.c:28:16: [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). FILE *fp = fopen (argv[1], "r"); data/esekeyd-1.2.7/src/parser.c:740:17: [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(ret_val, "KEY_%d", ev.code); data/esekeyd-1.2.7/src/esekeyd.c:149:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read; data/esekeyd-1.2.7/src/esekeyd.c:165:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (read && buff[read - 1] <= 32) data/esekeyd-1.2.7/src/esekeyd.c:167:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). --read; data/esekeyd-1.2.7/src/esekeyd.c:169:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!read) data/esekeyd-1.2.7/src/esekeyd.c:171:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). buff[read] = '\0'; data/esekeyd-1.2.7/src/esekeyd.c:297:39: [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 key_size = strlen (key); data/esekeyd-1.2.7/src/esekeyd.c:298:53: [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). keys_buff = realloc (keys_buff, strlen(keys_buff) data/esekeyd-1.2.7/src/esekeyd.c:301:21: [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 (keys_buff, key, key_size); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 1568 in approximately 0.08 seconds (18887 lines/second) Physical Source Lines of Code (SLOC) = 1355 Hits@level = [0] 83 [1] 8 [2] 15 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 112 [1+] 29 [2+] 21 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 82.6568 [1+] 21.4022 [2+] 15.4982 [3+] 4.42804 [4+] 4.42804 [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.