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/ethtool-5.9/netlink/netlink.c Examining data/ethtool-5.9/netlink/netlink.h Examining data/ethtool-5.9/netlink/extapi.h Examining data/ethtool-5.9/netlink/msgbuff.c Examining data/ethtool-5.9/netlink/msgbuff.h Examining data/ethtool-5.9/netlink/nlsock.c Examining data/ethtool-5.9/netlink/nlsock.h Examining data/ethtool-5.9/netlink/strset.c Examining data/ethtool-5.9/netlink/strset.h Examining data/ethtool-5.9/netlink/monitor.c Examining data/ethtool-5.9/netlink/bitset.c Examining data/ethtool-5.9/netlink/bitset.h Examining data/ethtool-5.9/netlink/settings.c Examining data/ethtool-5.9/netlink/parser.c Examining data/ethtool-5.9/netlink/parser.h Examining data/ethtool-5.9/netlink/permaddr.c Examining data/ethtool-5.9/netlink/prettymsg.c Examining data/ethtool-5.9/netlink/prettymsg.h Examining data/ethtool-5.9/netlink/features.c Examining data/ethtool-5.9/netlink/privflags.c Examining data/ethtool-5.9/netlink/rings.c Examining data/ethtool-5.9/netlink/channels.c Examining data/ethtool-5.9/netlink/coalesce.c Examining data/ethtool-5.9/netlink/pause.c Examining data/ethtool-5.9/netlink/eee.c Examining data/ethtool-5.9/netlink/tsinfo.c Examining data/ethtool-5.9/netlink/desc-ethtool.c Examining data/ethtool-5.9/netlink/desc-genlctrl.c Examining data/ethtool-5.9/netlink/desc-rtnl.c Examining data/ethtool-5.9/netlink/cable_test.c Examining data/ethtool-5.9/netlink/tunnels.c Examining data/ethtool-5.9/uapi/linux/ethtool.h Examining data/ethtool-5.9/uapi/linux/net_tstamp.h Examining data/ethtool-5.9/uapi/linux/ethtool_netlink.h Examining data/ethtool-5.9/uapi/linux/netlink.h Examining data/ethtool-5.9/uapi/linux/genetlink.h Examining data/ethtool-5.9/uapi/linux/rtnetlink.h Examining data/ethtool-5.9/uapi/linux/if_link.h Examining data/ethtool-5.9/ethtool.c Examining data/ethtool-5.9/internal.h Examining data/ethtool-5.9/rxclass.c Examining data/ethtool-5.9/common.c Examining data/ethtool-5.9/common.h Examining data/ethtool-5.9/json_writer.c Examining data/ethtool-5.9/json_writer.h Examining data/ethtool-5.9/json_print.c Examining data/ethtool-5.9/json_print.h Examining data/ethtool-5.9/amd8111e.c Examining data/ethtool-5.9/de2104x.c Examining data/ethtool-5.9/dsa.c Examining data/ethtool-5.9/e100.c Examining data/ethtool-5.9/e1000.c Examining data/ethtool-5.9/et131x.c Examining data/ethtool-5.9/igb.c Examining data/ethtool-5.9/fec.c Examining data/ethtool-5.9/fec_8xx.c Examining data/ethtool-5.9/ibm_emac.c Examining data/ethtool-5.9/ixgb.c Examining data/ethtool-5.9/ixgbe.c Examining data/ethtool-5.9/natsemi.c Examining data/ethtool-5.9/pcnet32.c Examining data/ethtool-5.9/realtek.c Examining data/ethtool-5.9/tg3.c Examining data/ethtool-5.9/marvell.c Examining data/ethtool-5.9/vioc.c Examining data/ethtool-5.9/smsc911x.c Examining data/ethtool-5.9/at76c50x-usb.c Examining data/ethtool-5.9/sfc.c Examining data/ethtool-5.9/stmmac.c Examining data/ethtool-5.9/sff-common.c Examining data/ethtool-5.9/sff-common.h Examining data/ethtool-5.9/sfpid.c Examining data/ethtool-5.9/sfpdiag.c Examining data/ethtool-5.9/ixgbevf.c Examining data/ethtool-5.9/tse.c Examining data/ethtool-5.9/vmxnet3.c Examining data/ethtool-5.9/qsfp.c Examining data/ethtool-5.9/qsfp.h Examining data/ethtool-5.9/fjes.c Examining data/ethtool-5.9/lan78xx.c Examining data/ethtool-5.9/igc.c Examining data/ethtool-5.9/qsfp-dd.c Examining data/ethtool-5.9/qsfp-dd.h Examining data/ethtool-5.9/bnxt.c Examining data/ethtool-5.9/test-cmdline.c Examining data/ethtool-5.9/test-common.c Examining data/ethtool-5.9/test-features.c FINAL RESULTS: data/ethtool-5.9/bnxt.c:80:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, stats[i].format, pcie_stat16); data/ethtool-5.9/bnxt.c:85:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, stats[i].format, pcie_stat32); data/ethtool-5.9/bnxt.c:90:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, stats[i].format, pcie_stat64); data/ethtool-5.9/ethtool.c:371:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, data/ethtool-5.9/ethtool.c:4371:2: [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(efl.data, flash_file); data/ethtool-5.9/ethtool.c:6015:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, PACKAGE " version " VERSION "\n"); data/ethtool-5.9/ethtool.c:6242:2: [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(ctx->ifr.ifr_name, ctx->devname); data/ethtool-5.9/fec_8xx.c:45:24: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DUMP_REG(f, x) fprintf(stdout, \ data/ethtool-5.9/json_print.c:105:24: [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. __attribute__((format(printf, 3, 0))) \ data/ethtool-5.9/json_print.c:117:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, fmt, value); \ data/ethtool-5.9/json_print.c:144:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, fmt, value); data/ethtool-5.9/json_print.c:164:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, fmt, value ? "true" : "false"); data/ethtool-5.9/json_print.c:182:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, fmt, hex); data/ethtool-5.9/json_print.c:200:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, fmt, hex); data/ethtool-5.9/json_print.c:219:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, fmt, value); data/ethtool-5.9/json_writer.c:157:23: [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. __attribute__((format(printf, 2, 3))) data/ethtool-5.9/json_writer.c:164: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(self->out, fmt, ap); data/ethtool-5.9/json_writer.h:32:23: [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. __attribute__((format(printf, 2, 3))) data/ethtool-5.9/netlink/parser.c:477:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, parser_data->err_msg, nlctx->param); data/ethtool-5.9/rxclass.c:1411:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(mask_name, "%s-mask", opt->name); data/ethtool-5.9/test-cmdline.c:327:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("ETHTOOL_TEST_VERBOSE")) data/ethtool-5.9/test-common.c:335:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("TEST_TEST_VERBOSE")) { data/ethtool-5.9/test-features.c:532:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("ETHTOOL_TEST_VERBOSE")) data/ethtool-5.9/bnxt.c:79: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(&pcie_stat16, &pcie_stats[stats[i].offset], sizeof(u16)); data/ethtool-5.9/bnxt.c:84: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(&pcie_stat32, &pcie_stats[stats[i].offset], sizeof(u32)); data/ethtool-5.9/bnxt.c:89: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(&pcie_stat64, &pcie_stats[stats[i].offset], sizeof(u64)); data/ethtool-5.9/common.c:101:9: [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. static char buf[16]; data/ethtool-5.9/de2104x.c:5:14: [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. static const char * const csr0_tap[4] = { data/ethtool-5.9/de2104x.c:12:14: [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. static const char * const csr0_cache_al[4] = { data/ethtool-5.9/de2104x.c:19:14: [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. static const char * const csr5_buserr[8] = { data/ethtool-5.9/de2104x.c:37:14: [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. static const char * const csr6_om[4] = { data/ethtool-5.9/de2104x.c:44:14: [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. static const char * const csr5_tx_state[8] = { data/ethtool-5.9/de2104x.c:55:14: [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. static const char * const csr5_rx_state[8] = { data/ethtool-5.9/de2104x.c:66:14: [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. static const char * const csr12_nway_state[8] = { data/ethtool-5.9/de2104x.c:77:14: [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. static const char * const csr14_tp_comp[4] = { data/ethtool-5.9/ethtool.c:107: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[ETH_GSTRING_LEN]; data/ethtool-5.9/ethtool.c:988:9: [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. static char buf[300]; data/ethtool-5.9/ethtool.c:994:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "L2DA\n"); data/ethtool-5.9/ethtool.c:996:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "VLAN tag\n"); data/ethtool-5.9/ethtool.c:998:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "L3 proto\n"); data/ethtool-5.9/ethtool.c:1000:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "IP SA\n"); data/ethtool-5.9/ethtool.c:1002:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "IP DA\n"); data/ethtool-5.9/ethtool.c:1004:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "L4 bytes 0 & 1 [TCP/UDP src port]\n"); data/ethtool-5.9/ethtool.c:1006:4: [2] (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). Risk is low because the source is a constant string. strcat(buf, "L4 bytes 2 & 3 [TCP/UDP dst port]\n"); data/ethtool-5.9/ethtool.c:1008:3: [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, "None"); data/ethtool-5.9/ethtool.c:1604: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. static char *so_timestamping_labels[N_SOTS] = { data/ethtool-5.9/ethtool.c:1616: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. static char *tx_type_labels[N_TX_TYPES] = { data/ethtool-5.9/ethtool.c:1624: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. static char *rx_filter_labels[N_RX_FILTERS] = { data/ethtool-5.9/ethtool.c:1768: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(defs->def[i].name, names->data + i * ETH_GSTRING_LEN, data/ethtool-5.9/ethtool.c:2687: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(link_usettings->link_modes.supported, data/ethtool-5.9/ethtool.c:2692: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(link_usettings->link_modes.advertising, data/ethtool-5.9/ethtool.c:2697: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(link_usettings->link_modes.lp_advertising, data/ethtool-5.9/ethtool.c:2734: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(&ecmd.link_mode_data[u32_offs], data/ethtool-5.9/ethtool.c:2739: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(&ecmd.link_mode_data[u32_offs], data/ethtool-5.9/ethtool.c:2744: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(&ecmd.link_mode_data[u32_offs], data/ethtool-5.9/ethtool.c:3346:13: [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 *f = fopen(gregs_dump_file, "r"); data/ethtool-5.9/ethtool.c:4327: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((char *)rss->rss_config + indir_bytes, data/ethtool-5.9/ethtool.c:4469: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(&ntuple->h_u, &fsp->h_u, sizeof(fsp->h_u)); data/ethtool-5.9/ethtool.c:4476: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(&ntuple->m_u, &fsp->m_u, sizeof(fsp->m_u)); data/ethtool-5.9/ethtool.c:4562: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(dump_file, "wb+"); data/ethtool-5.9/ethtool.c:4987:1: [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 data/ethtool-5.9/ethtool.c:5070: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(tuna->data, &tinfo[i].wanted, tuna->len); data/ethtool-5.9/ethtool.c:6081: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(per_queue_opt->queue_mask, queue_mask, data/ethtool-5.9/ethtool.c:6118: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(&ecoal, ecoal_q + idx, data/ethtool-5.9/ethtool.c:6127: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(ecoal_q + idx, &ecoal, data/ethtool-5.9/internal.h:201: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(dst, src, ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NBYTES); data/ethtool-5.9/internal.h:269: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). #undef open data/ethtool-5.9/internal.h:270: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). #define open(...) test_open(__VA_ARGS__) data/ethtool-5.9/internal.h:278:8: [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). #undef fopen data/ethtool-5.9/internal.h:279:9: [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). #define fopen(path, mode) test_fopen(path, mode) data/ethtool-5.9/json_print.c:20:25: [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. #define SPRINT_BUF(x) char x[SPRINT_BSIZE] data/ethtool-5.9/netlink/msgbuff.c:86: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(mnl_nlmsg_get_payload_tail(dest->nlhdr), src->payload, src_len); data/ethtool-5.9/netlink/parser.c:535: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 buff[__MAX_U32_DIGITS + 1] = {}; data/ethtool-5.9/netlink/parser.c:561: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(buff, p, chunk); data/ethtool-5.9/netlink/privflags.c: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 buff[16]; data/ethtool-5.9/netlink/settings.c:275:4: [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 buff[14]; data/ethtool-5.9/netlink/settings.c:796: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(wol.sopass, data/ethtool-5.9/netlink/settings.c:988:1: [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 wol_bit_chars[WOL_MODE_COUNT] = { data/ethtool-5.9/netlink/strset.c: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 devname[ALTIFNAMSIZ]; data/ethtool-5.9/netlink/strset.c:76: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(dest[idx].raw_data, tb_stringset[ETHTOOL_A_STRINGSET_STRINGS], data/ethtool-5.9/netlink/strset.c:136: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 devname[ALTIFNAMSIZ] = ""; data/ethtool-5.9/qsfp.c:747: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 power_string[MAX_DESC_SIZE]; data/ethtool-5.9/rxclass.c:26: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 sip_str[INET_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c:27: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 sipm_str[INET_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c: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 dip_str[INET_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c:29: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 dipm_str[INET_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c:45: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 sip_str[INET6_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c:46: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 sipm_str[INET6_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c:47: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 dip_str[INET6_ADDRSTRLEN]; data/ethtool-5.9/rxclass.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 dipm_str[INET6_ADDRSTRLEN]; data/ethtool-5.9/rxclass.c:1130: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(&p[opt->offset], val, sizeof(val)); data/ethtool-5.9/rxclass.c:1136:12: [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 val[ETH_ALEN]; data/ethtool-5.9/rxclass.c:1140: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(&p[opt->offset], val, ETH_ALEN); data/ethtool-5.9/rxclass.c:1142: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(&p[opt->moffset], &mask, ETH_ALEN); data/ethtool-5.9/rxclass.c:1246:12: [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 val[ETH_ALEN]; data/ethtool-5.9/rxclass.c:1255: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(&p[opt->moffset], val, ETH_ALEN); data/ethtool-5.9/rxclass.c:1391:4: [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 mask_name[16]; data/ethtool-5.9/test-common.c:86: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(dup, s, size); data/ethtool-5.9/test-common.c:153: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). node->fd = open(pathname, flag, mode); data/ethtool-5.9/test-common.c:208:13: [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). node->fh = fopen(path, mode); data/ethtool-5.9/test-common.c:282: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(cmd, expect->resp, expect->resp_len); data/ethtool-5.9/test-common.c:321: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(argv[i], arg, len); data/ethtool-5.9/test-common.c:326: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). dev_null = open("/dev/null", O_RDWR); data/ethtool-5.9/uapi/linux/ethtool.h:177: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 driver[32]; data/ethtool-5.9/uapi/linux/ethtool.h:178: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 version[32]; data/ethtool-5.9/uapi/linux/ethtool.h:179: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 fw_version[ETHTOOL_FWVERS_LEN]; data/ethtool-5.9/uapi/linux/ethtool.h:180: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 bus_info[ETHTOOL_BUSINFO_LEN]; data/ethtool-5.9/uapi/linux/ethtool.h:181: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 erom_version[ETHTOOL_EROMVERS_LEN]; data/ethtool-5.9/uapi/linux/ethtool.h:182: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 reserved2[12]; data/ethtool-5.9/uapi/linux/ethtool.h:967: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 h_dest[ETH_ALEN]; data/ethtool-5.9/uapi/linux/ethtool.h:1218: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 data[ETHTOOL_FLASH_MAX_FILENAME]; data/ethtool-5.9/ethtool.c:188:16: [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). size_t slen = strlen(s); data/ethtool-5.9/ethtool.c:715: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). indent = strlen(prefix) + 14; data/ethtool-5.9/ethtool.c:720:17: [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). indent - (int)strlen(prefix) - 12, ""); data/ethtool-5.9/ethtool.c:1784: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). strlen(pattern + 1); data/ethtool-5.9/ethtool.c:1785:24: [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). size_t name_len = strlen(name); data/ethtool-5.9/ethtool.c:3545:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((fgetc(stdin) != EOF) || !feof(stdin)) { data/ethtool-5.9/ethtool.c:4365:6: [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(flash_file) > ETHTOOL_FLASH_MAX_FILENAME - 1) { data/ethtool-5.9/ethtool.c:4688:13: [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). cur_len = strlen((const char *)strings->data + data/ethtool-5.9/ethtool.c:6234:6: [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(ctx->devname) >= IFNAMSIZ) { data/ethtool-5.9/netlink/features.c:95:21: [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). size_t name_len = strlen(name); data/ethtool-5.9/netlink/features.c:96:24: [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). size_t pattern_len = strlen(pattern); data/ethtool-5.9/netlink/monitor.c:183:13: [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). int slen = strlen(s); data/ethtool-5.9/netlink/msgbuff.h:114:35: [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). return ethnla_put(msgbuff, type, strlen(data) + 1, data); data/ethtool-5.9/netlink/netlink.c:84:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(ifname, mnl_attr_get_str(name_attr), ALTIFNAMSIZ); data/ethtool-5.9/netlink/netlink.c:309:22: [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 (ctx->devname && strlen(ctx->devname) >= ALTIFNAMSIZ) { data/ethtool-5.9/netlink/netlink.c:348:22: [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 (ctx->devname && strlen(ctx->devname) >= IFNAMSIZ) { data/ethtool-5.9/netlink/netlink.h:118:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dst, src, ALTIFNAMSIZ); data/ethtool-5.9/netlink/parser.c:542:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buff, arg, len); data/ethtool-5.9/netlink/parser.c:607:51: [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). len1 = maskptr ? (unsigned int)(maskptr - arg) : strlen(arg); data/ethtool-5.9/netlink/parser.c:617: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). len2 = strlen(maskptr); data/ethtool-5.9/netlink/parser.c:623:37: [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). ret = __parse_num_string(maskptr, strlen(maskptr), mask, data/ethtool-5.9/netlink/permaddr.c:49: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(devname) >= IFNAMSIZ) data/ethtool-5.9/netlink/privflags.c:28:9: [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/ethtool-5.9/netlink/settings.c:231:34: [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). const unsigned int before_len = strlen(before); data/ethtool-5.9/sfc.c:3747:15: [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). name_width = strlen(field->name); data/ethtool-5.9/sfc.c:3757:15: [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). name_width = strlen(field->name); data/ethtool-5.9/test-common.c:82:16: [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). size_t size = strlen(s) + 1; ANALYSIS SUMMARY: Hits = 138 Lines analyzed = 40878 in approximately 1.23 seconds (33162 lines/second) Physical Source Lines of Code (SLOC) = 32884 Hits@level = [0] 2502 [1] 27 [2] 88 [3] 3 [4] 20 [5] 0 Hits@level+ = [0+] 2640 [1+] 138 [2+] 111 [3+] 23 [4+] 20 [5+] 0 Hits/KSLOC@level+ = [0+] 80.2822 [1+] 4.19657 [2+] 3.3755 [3+] 0.699428 [4+] 0.608199 [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.