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/cc-tool-0.27/src/application/cc_base.cpp Examining data/cc-tool-0.27/src/application/cc_base.h Examining data/cc-tool-0.27/src/application/cc_flasher.cpp Examining data/cc-tool-0.27/src/application/cc_flasher.h Examining data/cc-tool-0.27/src/common/common.cpp Examining data/cc-tool-0.27/src/common/common.h Examining data/cc-tool-0.27/src/common/log.cpp Examining data/cc-tool-0.27/src/common/log.h Examining data/cc-tool-0.27/src/common/timer.cpp Examining data/cc-tool-0.27/src/common/timer.h Examining data/cc-tool-0.27/src/data/binary_file.cpp Examining data/cc-tool-0.27/src/data/binary_file.h Examining data/cc-tool-0.27/src/data/data_section.cpp Examining data/cc-tool-0.27/src/data/data_section.h Examining data/cc-tool-0.27/src/data/data_section_store.cpp Examining data/cc-tool-0.27/src/data/data_section_store.h Examining data/cc-tool-0.27/src/data/file.cpp Examining data/cc-tool-0.27/src/data/file.h Examining data/cc-tool-0.27/src/data/hex_file.cpp Examining data/cc-tool-0.27/src/data/hex_file.h Examining data/cc-tool-0.27/src/data/progress_watcher.cpp Examining data/cc-tool-0.27/src/data/progress_watcher.h Examining data/cc-tool-0.27/src/data/read_target.cpp Examining data/cc-tool-0.27/src/data/read_target.h Examining data/cc-tool-0.27/src/main.cpp Examining data/cc-tool-0.27/src/programmer/cc_243x.cpp Examining data/cc-tool-0.27/src/programmer/cc_243x.h Examining data/cc-tool-0.27/src/programmer/cc_251x_111x.cpp Examining data/cc-tool-0.27/src/programmer/cc_251x_111x.h Examining data/cc-tool-0.27/src/programmer/cc_253x_254x.cpp Examining data/cc-tool-0.27/src/programmer/cc_253x_254x.h Examining data/cc-tool-0.27/src/programmer/cc_debug_interface.h Examining data/cc-tool-0.27/src/programmer/cc_programmer.cpp Examining data/cc-tool-0.27/src/programmer/cc_programmer.h Examining data/cc-tool-0.27/src/programmer/cc_unit_driver.cpp Examining data/cc-tool-0.27/src/programmer/cc_unit_driver.h Examining data/cc-tool-0.27/src/programmer/cc_unit_info.cpp Examining data/cc-tool-0.27/src/programmer/cc_unit_info.h Examining data/cc-tool-0.27/src/usb/usb_device.cpp Examining data/cc-tool-0.27/src/usb/usb_device.h Examining data/cc-tool-0.27/src/version.h FINAL RESULTS: data/cc-tool-0.27/src/common/log.cpp:49:3: [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(file_, message.c_str(), ap); data/cc-tool-0.27/src/application/cc_base.cpp:183:29: [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). open_result = programmer_.open(bus, device); data/cc-tool-0.27/src/application/cc_base.cpp:191:29: [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). open_result = programmer_.open(); data/cc-tool-0.27/src/common/common.cpp:24: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[3] = { 0, 0, 0 }; data/cc-tool-0.27/src/common/log.cpp:31: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). file_ = fopen(file_name.c_str(), "w"); data/cc-tool-0.27/src/common/log.cpp:42: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 time_stamp[64] = { '\0' }; data/cc-tool-0.27/src/common/log.cpp:44:2: [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(time_stamp + strlen(time_stamp), "%05d", get_tick_count() % 100000); data/cc-tool-0.27/src/common/timer.cpp:32: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[16]; data/cc-tool-0.27/src/common/timer.cpp:33:2: [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(buf, "%.02f s.", (float)elapsed_time / 1000); data/cc-tool-0.27/src/data/binary_file.cpp:26:15: [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 *file = fopen(file_name.c_str(), "r"); data/cc-tool-0.27/src/data/binary_file.cpp:49:15: [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 *file = fopen(file_name.c_str(), "w"); data/cc-tool-0.27/src/data/file.cpp:44: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). void File::open(const String &file_name, const char mode[], off_t max_size) data/cc-tool-0.27/src/data/file.cpp:50: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). file_ = fopen(file_name.c_str(), mode); data/cc-tool-0.27/src/data/file.h:19: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). void open(const String &file_name, const char mode[], off_t max_size = 0); // throw data/cc-tool-0.27/src/data/hex_file.cpp:104: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[3] = { low_part, high_part, 0 }; data/cc-tool-0.27/src/programmer/cc_243x.cpp:174: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(&block[mac_offset - page_offset], &mac_address[0], mac_address.size()); data/cc-tool-0.27/src/programmer/cc_253x_254x.cpp:363: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(&block[mac_address_offset() - page_offset], &mac_address[0], data/cc-tool-0.27/src/programmer/cc_253x_254x.cpp:371: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(&block[lock_data_offset() - page_offset], &lock_data[0], data/cc-tool-0.27/src/programmer/cc_programmer.cpp:136:42: [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). CC_Programmer::OpenResult CC_Programmer::open(uint_t bus, uint_t device) data/cc-tool-0.27/src/programmer/cc_programmer.cpp:158:42: [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). CC_Programmer::OpenResult CC_Programmer::open() data/cc-tool-0.27/src/programmer/cc_programmer.cpp:189: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 DID[16]; data/cc-tool-0.27/src/programmer/cc_programmer.cpp:190:2: [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(DID, "%02X%02X", data/cc-tool-0.27/src/programmer/cc_programmer.cpp:276: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(&command[0x00], unit_info_.name.c_str(), unit_info_.name.size()); data/cc-tool-0.27/src/programmer/cc_programmer.cpp:277: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(&command[0x10], "DID:", 4); data/cc-tool-0.27/src/programmer/cc_programmer.cpp:278: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(&command[0x15], programmer_info_.debugger_id.c_str(), programmer_info_.debugger_id.size()); data/cc-tool-0.27/src/programmer/cc_programmer.h:28: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 description[256]; data/cc-tool-0.27/src/programmer/cc_programmer.h:56: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). OpenResult open(); data/cc-tool-0.27/src/programmer/cc_programmer.h:57: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). OpenResult open(uint_t bus, uint_t device); data/cc-tool-0.27/src/application/cc_base.cpp:239: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(e.what())) data/cc-tool-0.27/src/application/cc_base.cpp:249: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(e.what())) data/cc-tool-0.27/src/common/log.cpp:44:23: [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). sprintf(time_stamp + strlen(time_stamp), "%05d", get_tick_count() % 100000); data/cc-tool-0.27/src/data/file.cpp:113:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void File::read(uint8_t data[], size_t size) data/cc-tool-0.27/src/data/file.cpp:122:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void File::read(ByteVector &data, size_t size) data/cc-tool-0.27/src/data/file.h:28:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(uint8_t data[], size_t size); // throw data/cc-tool-0.27/src/data/file.h:29:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read(ByteVector &data, size_t size); // throw data/cc-tool-0.27/src/programmer/cc_programmer.cpp:343: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(500 * 1000); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 5738 in approximately 0.14 seconds (40253 lines/second) Physical Source Lines of Code (SLOC) = 3954 Hits@level = [0] 6 [1] 8 [2] 27 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 42 [1+] 36 [2+] 28 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 10.6222 [1+] 9.1047 [2+] 7.08144 [3+] 0.252908 [4+] 0.252908 [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.