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/g810-led-0.4.2/src/classes/Keyboard.cpp Examining data/g810-led-0.4.2/src/classes/Keyboard.h Examining data/g810-led-0.4.2/src/helpers/help.cpp Examining data/g810-led-0.4.2/src/helpers/help.h Examining data/g810-led-0.4.2/src/helpers/utils.cpp Examining data/g810-led-0.4.2/src/helpers/utils.h Examining data/g810-led-0.4.2/src/main.cpp FINAL RESULTS: data/g810-led-0.4.2/src/classes/Keyboard.cpp:59: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. char buf[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:66: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. char buf[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:73: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. char buf[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:102:17: [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 buf[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:140:19: [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). bool LedKeyboard::open() { data/g810-led-0.4.2/src/classes/Keyboard.cpp:143:9: [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). return open(0x0, 0x0, ""); data/g810-led-0.4.2/src/classes/Keyboard.cpp:146:19: [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). bool LedKeyboard::open(uint16_t vendorID, uint16_t productID, string serial) { data/g810-led-0.4.2/src/classes/Keyboard.cpp:159:4: [2] (buffer) wchar_t: 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. wchar_t tempSerial[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:170:7: [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[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:177:7: [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[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:184:7: [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[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:235:15: [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 buf[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:272:17: [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 buf[256]; data/g810-led-0.4.2/src/classes/Keyboard.cpp:1020:10: [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 (! open(currentDevice.vendorID, currentDevice.productID, currentDevice.serialNumber)) return false; data/g810-led-0.4.2/src/classes/Keyboard.cpp:1044:13: [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[64]; data/g810-led-0.4.2/src/classes/Keyboard.h:190: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). bool open(); data/g810-led-0.4.2/src/classes/Keyboard.h:191: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). bool open(uint16_t vendorID, uint16_t productID, std::string serial); data/g810-led-0.4.2/src/main.cpp:29:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:60:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:71:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:83:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:92:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:100:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:108:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:152:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:172:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:180:12: [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 (! kbd.open()) return 1; data/g810-led-0.4.2/src/main.cpp:206:13: [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 (kbd.open()) { data/g810-led-0.4.2/src/main.cpp:247: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). file.open(arg2); data/g810-led-0.4.2/src/main.cpp:325:12: [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 (!kbd.open(vendorID, productID, serial)) { data/g810-led-0.4.2/src/classes/Keyboard.cpp:1043: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(1000); data/g810-led-0.4.2/src/classes/Keyboard.h:147:46: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. enter, esc, backspace, tab, space, minus, equal, open_bracket, close_bracket, data/g810-led-0.4.2/src/classes/Keyboard.h:249:71: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. Key::enter, Key::backspace, Key::tab, Key::space, Key::minus, Key::equal, data/g810-led-0.4.2/src/helpers/utils.cpp:124:66: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. else if (val == "equal" || val == "=") key = LedKeyboard::Key::equal; ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 2502 in approximately 0.11 seconds (22834 lines/second) Physical Source Lines of Code (SLOC) = 2110 Hits@level = [0] 0 [1] 4 [2] 30 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 34 [1+] 34 [2+] 30 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 16.1137 [1+] 16.1137 [2+] 14.218 [3+] 0 [4+] 0 [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.