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/libjaylink-0.2.0/libjaylink/buffer.c Examining data/libjaylink-0.2.0/libjaylink/core.c Examining data/libjaylink-0.2.0/libjaylink/device.c Examining data/libjaylink-0.2.0/libjaylink/discovery.c Examining data/libjaylink-0.2.0/libjaylink/discovery_tcp.c Examining data/libjaylink-0.2.0/libjaylink/discovery_usb.c Examining data/libjaylink-0.2.0/libjaylink/emucom.c Examining data/libjaylink-0.2.0/libjaylink/error.c Examining data/libjaylink-0.2.0/libjaylink/fileio.c Examining data/libjaylink-0.2.0/libjaylink/jtag.c Examining data/libjaylink-0.2.0/libjaylink/libjaylink-internal.h Examining data/libjaylink-0.2.0/libjaylink/libjaylink.h Examining data/libjaylink-0.2.0/libjaylink/list.c Examining data/libjaylink-0.2.0/libjaylink/log.c Examining data/libjaylink-0.2.0/libjaylink/socket.c Examining data/libjaylink-0.2.0/libjaylink/strutil.c Examining data/libjaylink-0.2.0/libjaylink/swd.c Examining data/libjaylink-0.2.0/libjaylink/swo.c Examining data/libjaylink-0.2.0/libjaylink/target.c Examining data/libjaylink-0.2.0/libjaylink/transport.c Examining data/libjaylink-0.2.0/libjaylink/transport_tcp.c Examining data/libjaylink-0.2.0/libjaylink/transport_usb.c Examining data/libjaylink-0.2.0/libjaylink/util.c Examining data/libjaylink-0.2.0/libjaylink/version.c FINAL RESULTS: data/libjaylink-0.2.0/libjaylink/device.c:1398:3: [4] (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). strcpy(conns[i].hid, inet_ntoa(in)); data/libjaylink-0.2.0/libjaylink/log.c:187: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/libjaylink-0.2.0/libjaylink/buffer.c:54: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(buffer + offset, &value, sizeof(value)); data/libjaylink-0.2.0/libjaylink/buffer.c:108: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(buffer + offset, &value, sizeof(value)); data/libjaylink-0.2.0/libjaylink/device.c:369: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(address, dev->ipv4_address, sizeof(dev->ipv4_address)); data/libjaylink-0.2.0/libjaylink/device.c:402: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(address, dev->mac_address, sizeof(dev->mac_address)); data/libjaylink-0.2.0/libjaylink/device.c:471: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(name, dev->product_name, sizeof(dev->product_name)); data/libjaylink-0.2.0/libjaylink/device.c:504: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(nickname, dev->nickname, sizeof(dev->nickname)); data/libjaylink-0.2.0/libjaylink/discovery_tcp.c:126: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(&in, buffer + 16, 4); data/libjaylink-0.2.0/libjaylink/discovery_tcp.c: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(buf, "Discover", 8); data/libjaylink-0.2.0/libjaylink/discovery_usb.c:141: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[USB_SERIAL_NUMBER_LENGTH + 1]; data/libjaylink-0.2.0/libjaylink/fileio.c:119: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(buf + 5, filename, filename_length); data/libjaylink-0.2.0/libjaylink/fileio.c:254: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(buf + 5, filename, filename_length); data/libjaylink-0.2.0/libjaylink/fileio.c:373: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(buf + 5, filename, length); data/libjaylink-0.2.0/libjaylink/fileio.c:465: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(buf + 5, filename, length); data/libjaylink-0.2.0/libjaylink/libjaylink-internal.h:81: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 log_domain[JAYLINK_LOG_DOMAIN_MAX_LENGTH + 1]; data/libjaylink-0.2.0/libjaylink/libjaylink-internal.h:114: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 ipv4_address[INET_ADDRSTRLEN]; data/libjaylink-0.2.0/libjaylink/libjaylink-internal.h: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 product_name[JAYLINK_PRODUCT_NAME_MAX_LENGTH]; data/libjaylink-0.2.0/libjaylink/libjaylink-internal.h:139: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 nickname[JAYLINK_NICKNAME_MAX_LENGTH]; data/libjaylink-0.2.0/libjaylink/libjaylink.h:339: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 hid[INET_ADDRSTRLEN]; data/libjaylink-0.2.0/libjaylink/transport_tcp.c:138: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[SERVER_NAME_MAX_LENGTH]; data/libjaylink-0.2.0/libjaylink/transport_tcp.c:506: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(devh->buffer + devh->write_pos, buffer, length); data/libjaylink-0.2.0/libjaylink/transport_tcp.c:531: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(devh->buffer + devh->write_pos, buffer, tmp); data/libjaylink-0.2.0/libjaylink/transport_tcp.c:567: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(buffer, devh->buffer + devh->read_pos, length); data/libjaylink-0.2.0/libjaylink/transport_tcp.c:578: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(buffer, devh->buffer + devh->read_pos, data/libjaylink-0.2.0/libjaylink/transport_usb.c:469: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(devh->buffer + devh->write_pos, buffer, length); data/libjaylink-0.2.0/libjaylink/transport_usb.c:504: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(devh->buffer + devh->write_pos, buffer, tmp); data/libjaylink-0.2.0/libjaylink/transport_usb.c:544: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(buffer, devh->buffer + devh->read_pos, length); data/libjaylink-0.2.0/libjaylink/transport_usb.c:555: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(buffer, devh->buffer + devh->read_pos, data/libjaylink-0.2.0/libjaylink/transport_usb.c:587:4: [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(buffer, devh->buffer, tmp); data/libjaylink-0.2.0/libjaylink/discovery_usb.c:88:11: [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). length = strlen(str); data/libjaylink-0.2.0/libjaylink/fileio.c:96:20: [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). filename_length = strlen(filename); data/libjaylink-0.2.0/libjaylink/fileio.c:231:20: [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). filename_length = strlen(filename); data/libjaylink-0.2.0/libjaylink/fileio.c:350:11: [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). length = strlen(filename); data/libjaylink-0.2.0/libjaylink/fileio.c:442:11: [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). length = strlen(filename); ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 8525 in approximately 0.23 seconds (37387 lines/second) Physical Source Lines of Code (SLOC) = 4431 Hits@level = [0] 6 [1] 5 [2] 28 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 41 [1+] 35 [2+] 30 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 9.25299 [1+] 7.89889 [2+] 6.77048 [3+] 0.451365 [4+] 0.451365 [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.