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/mdetect-0.5.2.4/mdetect.c Examining data/mdetect-0.5.2.4/mdetect.h Examining data/mdetect-0.5.2.4/mice.c FINAL RESULTS: data/mdetect-0.5.2.4/mdetect.c:439:2: [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(strcpy(temp.name, "/dev/"), name); data/mdetect-0.5.2.4/mice.c:30:4: [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. printf(isprint(buffer[j])? "%c" : "\\%03o", data/mdetect-0.5.2.4/mdetect.c:40:14: [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 ((c = getopt(argc, argv, "hnorvx")) != -1) { data/mdetect-0.5.2.4/mdetect.c:200:3: [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(&set, &mouse_set, sizeof(mouse_set)); data/mdetect-0.5.2.4/mdetect.c:439:9: [2] (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). Risk is low because the source is a constant string. strcat(strcpy(temp.name, "/dev/"), name); data/mdetect-0.5.2.4/mdetect.c:479:17: [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). if ((temp.fd = open(temp.name, O_RDWR)) < 0) data/mdetect-0.5.2.4/mdetect.c:482:2: [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(dev, &temp, sizeof(*dev)); data/mdetect-0.5.2.4/mdetect.h:12: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 name[64]; data/mdetect-0.5.2.4/mdetect.h:37: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 buffer[256]; data/mdetect-0.5.2.4/mice.c:69: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 buffer[10]; data/mdetect-0.5.2.4/mice.c:375: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 buffer[20]; data/mdetect-0.5.2.4/mice.c:422:18: [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). if ((dev->fd = open(dev->name, O_RDWR)) < 0) { data/mdetect-0.5.2.4/mice.c:690:2: [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(tmp, driver, sizeof(*tmp)); data/mdetect-0.5.2.4/mdetect.c:276:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(dev->fd, &c, 1) >= 0) data/mdetect-0.5.2.4/mdetect.c:291:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(dev->fd, &c, 1) < 0) data/mdetect-0.5.2.4/mice.c:20:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (n < size && read(dev->fd, &x, 1) > 0) { data/mdetect-0.5.2.4/mice.c:77:3: [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(10000); data/mdetect-0.5.2.4/mice.c:381:2: [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(10000); data/mdetect-0.5.2.4/mice.c:387:2: [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(10000); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 1283 in approximately 0.04 seconds (33685 lines/second) Physical Source Lines of Code (SLOC) = 1022 Hits@level = [0] 40 [1] 6 [2] 10 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 59 [1+] 19 [2+] 13 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 57.7299 [1+] 18.591 [2+] 12.7202 [3+] 2.93542 [4+] 1.95695 [5+] 0 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.