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/evemu-2.7.0/test/test-cxx-compile.cpp Examining data/evemu-2.7.0/test/test-c-compile.c Examining data/evemu-2.7.0/test/test-evemu-create.c Examining data/evemu-2.7.0/src/evemu.c Examining data/evemu-2.7.0/src/evemu.h Examining data/evemu-2.7.0/src/evemu-impl.h Examining data/evemu-2.7.0/src/version.h Examining data/evemu-2.7.0/tools/find_event_devices.h Examining data/evemu-2.7.0/tools/evemu-record.c Examining data/evemu-2.7.0/tools/evemu-echo.c Examining data/evemu-2.7.0/tools/evemu-event.c Examining data/evemu-2.7.0/tools/evemu-play.c Examining data/evemu-2.7.0/tools/find_event_devices.c FINAL RESULTS: data/evemu-2.7.0/src/evemu.c:73:34: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 3))); data/evemu-2.7.0/src/evemu.c:88:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, format, args); data/evemu-2.7.0/tools/evemu-event.c:94:7: [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. c = getopt_long(argc, argv, "", opts, &option_index); data/evemu-2.7.0/tools/evemu-record.c:260:7: [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. c = getopt_long(argc, argv, "", opts, &option_index); data/evemu-2.7.0/src/evemu.c:255:11: [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. unsigned char mask[max(8, (INPUT_PROP_MAX + 7)/8)] = {0}; data/evemu-2.7.0/src/evemu.c:281:12: [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. unsigned char mask[KEY_CNT] = {0}; data/evemu-2.7.0/src/evemu.c:400: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 modalias[2048]; data/evemu-2.7.0/src/evemu.c:410:8: [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). dmi = fopen("/sys/class/dmi/id/modalias", "r"); data/evemu-2.7.0/src/evemu.c:497:11: [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. unsigned char mask[8]; data/evemu-2.7.0/src/evemu.c:525:11: [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. unsigned char mask[8]; data/evemu-2.7.0/test/test-evemu-create.c:139: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(file, "r"); data/evemu-2.7.0/test/test-evemu-create.c:207:12: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). if ((fd = mkstemp(tmpname)) == -1) { data/evemu-2.7.0/tools/evemu-echo.c:83: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(argv[1], "r"); data/evemu-2.7.0/tools/evemu-event.c:153: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). fd = open(path, O_WRONLY); data/evemu-2.7.0/tools/evemu-play.c:62: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). fd = open(device_node, O_RDWR); data/evemu-2.7.0/tools/evemu-play.c:76: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 data[256]; data/evemu-2.7.0/tools/evemu-play.c:104: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 name[64]; data/evemu-2.7.0/tools/evemu-play.c:105: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(name, "evemu-%d", getpid()); data/evemu-2.7.0/tools/evemu-play.c:145: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(argv[1], "r"); data/evemu-2.7.0/tools/evemu-play.c:196: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[32]; data/evemu-2.7.0/tools/evemu-play.c:233: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). fd = open(argv[1], O_RDWR); data/evemu-2.7.0/tools/evemu-record.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 buf[64]; data/evemu-2.7.0/tools/evemu-record.c:167:13: [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). output = fopen(filename, "w"); data/evemu-2.7.0/tools/evemu-record.c:286: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). fd = open(device, O_RDONLY | O_NONBLOCK); data/evemu-2.7.0/tools/evemu-record.c:325:13: [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). output = fopen(prefix, "w"); data/evemu-2.7.0/tools/find_event_devices.c:60: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 fname[PATH_MAX]; data/evemu-2.7.0/tools/find_event_devices.c:62: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 name[256] = "???"; data/evemu-2.7.0/tools/find_event_devices.c:66:8: [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). fd = open(fname, O_RDONLY); data/evemu-2.7.0/src/evemu.c:96: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). return line && strlen(line) > 0 && line[0] == '#'; data/evemu-2.7.0/src/evemu.c:107:22: [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). } while(*sz == 0 || strlen(*line) <= 1); data/evemu-2.7.0/src/evemu.c:462: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(evemu_get_name(dev)) == 0) data/evemu-2.7.0/src/evemu.c:500: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(line) <= 2 || strncmp(line, "P:", 2) != 0) data/evemu-2.7.0/src/evemu.c:528: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(line) <= 2 || strncmp(line, "B:", 2) != 0) data/evemu-2.7.0/src/evemu.c:572: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(line) <= 2 || strncmp(line, "A:", 2) != 0) data/evemu-2.7.0/src/evemu.c:599: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(line) <= 2 || strncmp(line, "L:", 2) != 0) data/evemu-2.7.0/src/evemu.c:621: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(line) <= 2 || strncmp(line, "S:", 2) != 0) data/evemu-2.7.0/src/evemu.c:729: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). fseek(fp, -strlen(line), SEEK_CUR); data/evemu-2.7.0/src/evemu.c:799:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). SYSCALL(ret = read(fd, &ev, sizeof(ev))); data/evemu-2.7.0/src/evemu.c:830: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). } while(strlen(line) > 2 && strncmp(line, "E:", 2) != 0); data/evemu-2.7.0/src/evemu.c:832: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(line) <= 2 || strncmp(line, "E:", 2) != 0) data/evemu-2.7.0/src/evemu.c:891: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(usec - ERROR_MARGIN); data/evemu-2.7.0/tools/evemu-play.c:84:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ret = read(fd, data, sizeof(data))) > 0) data/evemu-2.7.0/tools/evemu-play.c:103: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(evemu_get_name(dev)) == 0) { ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 2810 in approximately 0.13 seconds (22210 lines/second) Physical Source Lines of Code (SLOC) = 1717 Hits@level = [0] 94 [1] 15 [2] 24 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 137 [1+] 43 [2+] 28 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 79.7903 [1+] 25.0437 [2+] 16.3075 [3+] 2.32964 [4+] 1.16482 [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.