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/xwiimote-2/lib/core.c Examining data/xwiimote-2/lib/monitor.c Examining data/xwiimote-2/lib/xwiimote.h Examining data/xwiimote-2/tools/xwiidump.c Examining data/xwiimote-2/tools/xwiishow.c FINAL RESULTS: data/xwiimote-2/tools/xwiishow.c:51:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(str, sizeof(str), format, list); data/xwiimote-2/tools/xwiishow.c:65:2: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(str, sizeof(str), format, list); data/xwiimote-2/lib/core.c:72: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 *led_attrs[4]; data/xwiimote-2/lib/core.c:485: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[256]; data/xwiimote-2/lib/core.c:497: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(dev->ifs[tif].node, flags); data/xwiimote-2/lib/core.c:815: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:845: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:846: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(ev->v.abs, &dev->accel_cache, sizeof(dev->accel_cache)); data/xwiimote-2/lib/core.c:887: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:888: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(&ev->v.abs, dev->ir_cache, sizeof(dev->ir_cache)); data/xwiimote-2/lib/core.c:939: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:991: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:992: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(&ev->v.abs, dev->bboard_cache, data/xwiimote-2/lib/core.c:1120: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:1136: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(&ev->time, &input.time, sizeof(struct timeval)); data/xwiimote-2/lib/core.c:1137: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(&ev->v.abs, dev->pro_cache, data/xwiimote-2/lib/core.c:1251: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(u_ev, &ev, size); data/xwiimote-2/lib/core.c:1290: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[4096], *line; data/xwiimote-2/lib/core.c:1292:6: [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). f = fopen(path, "re"); data/xwiimote-2/lib/core.c:1319:6: [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). f = fopen(path, "we"); data/xwiimote-2/lib/core.c:1344:13: [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). *state = !!atoi(line); data/xwiimote-2/lib/core.c:1387: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). *capacity = atoi(line); data/xwiimote-2/tools/xwiidump.c:38: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[1]; data/xwiimote-2/tools/xwiidump.c:73: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(file, O_RDONLY); data/xwiimote-2/tools/xwiishow.c:48: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 str[58 + 1]; data/xwiimote-2/tools/xwiishow.c:62: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 str[58 + 80 + 1]; data/xwiimote-2/tools/xwiishow.c:1653:19: [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). path = get_dev(atoi(argv[1])); data/xwiimote-2/lib/core.c:233: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). len = strlen(name); data/xwiimote-2/lib/core.c:737:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, ev, sizeof(*ev)); data/xwiimote-2/tools/xwiidump.c:47:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 4582 in approximately 0.12 seconds (38305 lines/second) Physical Source Lines of Code (SLOC) = 2991 Hits@level = [0] 36 [1] 3 [2] 25 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 66 [1+] 30 [2+] 27 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 22.0662 [1+] 10.0301 [2+] 9.02708 [3+] 0.668673 [4+] 0.668673 [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.