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/tcpstat-1.5/include/ethernet_stub.h Examining data/tcpstat-1.5/include/packetdump.h Examining data/tcpstat-1.5/include/snoop.h Examining data/tcpstat-1.5/include/tcpprof.h Examining data/tcpstat-1.5/include/tcpstat.h Examining data/tcpstat-1.5/lib/print_packet.c Examining data/tcpstat-1.5/lib/process.c Examining data/tcpstat-1.5/lib/tcpseq.c Examining data/tcpstat-1.5/lib/utils.c Examining data/tcpstat-1.5/src/catpcap.c Examining data/tcpstat-1.5/src/dump.c Examining data/tcpstat-1.5/src/tcpprof.c Examining data/tcpstat-1.5/src/tcpstat.c Examining data/tcpstat-1.5/src/stats.c FINAL RESULTS: data/tcpstat-1.5/include/tcpstat.h:139:11: [4] (format) snprintf: 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. # define snprintf(a, b, c...) sprintf(a, ## c) data/tcpstat-1.5/include/tcpstat.h:139:33: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. # define snprintf(a, b, c...) sprintf(a, ## c) data/tcpstat-1.5/include/tcpstat.h:141:11: [4] (format) snprintf: 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. # define snprintf(a, b, c, d) sprintf(a, c, d) data/tcpstat-1.5/include/tcpstat.h:141:33: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. # define snprintf(a, b, c, d) sprintf(a, c, d) data/tcpstat-1.5/lib/utils.c:174:5: [4] (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). strcat(dst, c); data/tcpstat-1.5/lib/utils.c:177:5: [4] (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). strcat(dst, c); data/tcpstat-1.5/src/catpcap.c:139: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, USAGE, prog); return r; data/tcpstat-1.5/src/dump.c:89: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, USAGE, my_basename(prog)); return r; data/tcpstat-1.5/src/stats.c:207:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s %s", label, suffix); /* XXX: Why is this here? */ data/tcpstat-1.5/src/stats.c:430:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", inet_ntoa(*addr)); data/tcpstat-1.5/src/stats.c:440:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", inet_ntoa(*addr)); data/tcpstat-1.5/src/tcpprof.c:102: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, USAGE, my_basename(prog), prog); data/tcpstat-1.5/src/tcpstat.c:155:2: [4] (format) snprintf: 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. snprintf(printval_str, BUF_SIZ, (x),(y)); \ data/tcpstat-1.5/src/tcpstat.c:518: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, USAGE, my_basename(prog)); data/tcpstat-1.5/src/tcpstat.c:535: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(stderr, SETUID_WARNING); data/tcpstat-1.5/src/catpcap.c:152:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ( (ch = getopt(argc, argv, "h?f:r:")) != -1) { data/tcpstat-1.5/src/dump.c:102:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ( (ch = getopt(argc, argv, "h?lf:r:s:")) != -1) { data/tcpstat-1.5/src/tcpprof.c:119:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ( (ch = getopt(argc, argv, "h?ndpP:Rf:i:s:S:r:t:")) != -1) { data/tcpstat-1.5/src/tcpstat.c:545:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ( (ch = getopt(argc, argv, "h?aeFlp1B:b:f:i:o:R:r:s:")) != -1) { data/tcpstat-1.5/include/snoop.h:34: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 magic[8]; /* is "snoop\0\0\0" */ data/tcpstat-1.5/lib/print_packet.c:33: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 gstr[8192]; data/tcpstat-1.5/lib/print_packet.c:145: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 indnt[64] = " "; data/tcpstat-1.5/lib/print_packet.c: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 indnt[64] = " "; data/tcpstat-1.5/lib/print_packet.c:204: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 indnt[64] = " "; data/tcpstat-1.5/lib/process.c:63: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(fname, O_RDONLY); data/tcpstat-1.5/lib/process.c:147:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(&(ep->ether_shost), &(pdata.ether.ether_shost), sizeof(struct ether_addr)); data/tcpstat-1.5/lib/process.c:148:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(&(ep->ether_dhost), &(pdata.ether.ether_dhost), sizeof(struct ether_addr)); data/tcpstat-1.5/lib/process.c:220:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy((void *)&(h->ts), &(pdata.timestamp), sizeof(struct timeval) ); data/tcpstat-1.5/lib/process.c:221:2: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(packet, &(pdata.data.raw), length); data/tcpstat-1.5/lib/process.c:252: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(fname, O_RDONLY); data/tcpstat-1.5/lib/process.c:319: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 ebuf[PCAP_ERRBUF_SIZE]; data/tcpstat-1.5/lib/utils.c:32: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 str[BUF_SIZ]; data/tcpstat-1.5/lib/utils.c:161: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 c[2]; data/tcpstat-1.5/src/catpcap.c:45: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 filterexpr[BUF_SIZ] = ""; data/tcpstat-1.5/src/catpcap.c:98: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 ebuf[PCAP_ERRBUF_SIZE]; data/tcpstat-1.5/src/catpcap.c:148: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 filename[BUF_SIZ]; data/tcpstat-1.5/src/dump.c:37: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 filterexpr[BUF_SIZ] = ""; data/tcpstat-1.5/src/dump.c:98: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 filename[BUF_SIZ]; data/tcpstat-1.5/src/stats.c:109:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(dbt.data, (void *) su, sizeof(stat_unit) ); data/tcpstat-1.5/src/stats.c:125:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(dbt.data, (void *) su, sizeof(stat_unit) ); data/tcpstat-1.5/src/stats.c:126:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(key_dbt.data, (void *) key, sizeof(stkey_t) ); data/tcpstat-1.5/src/stats.c:168:18: [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(dbs[i].db->open(dbs[i].db, 0, NULL, NULL, DB_BTREE, data/tcpstat-1.5/src/stats.c:206: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[1024]; data/tcpstat-1.5/src/stats.c:308: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[256]; data/tcpstat-1.5/src/stats.c:334:6: [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(str, "Ethernet (IP):"); break; data/tcpstat-1.5/src/stats.c:337:6: [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(str, "Ethernet (IPv6):"); break; data/tcpstat-1.5/src/stats.c:340:6: [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(str, "Ethernet (arp):"); break; data/tcpstat-1.5/src/stats.c:342:6: [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(str, "Ethernet (revarp):"); break; data/tcpstat-1.5/src/stats.c:344:6: [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(str, "Ethernet (IPX):"); break; data/tcpstat-1.5/src/stats.c:346:6: [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(str, "Ethernet (AppleTalk):"); break; data/tcpstat-1.5/src/stats.c:348:6: [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(str, "Ethernet (AppleTalk ARP):"); break; data/tcpstat-1.5/src/stats.c:350:6: [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(str, "Ethernet (other):"); break; data/tcpstat-1.5/src/stats.c:356:6: [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(str, "PPP (IP):"); break; data/tcpstat-1.5/src/stats.c:359:6: [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(str, "PPP (IPv6):"); break; data/tcpstat-1.5/src/stats.c:361:6: [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(str, "PPP (IPCP6):"); break; data/tcpstat-1.5/src/stats.c:364:6: [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(str, "PPP (IPCP):"); break; data/tcpstat-1.5/src/stats.c:366:6: [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(str, "PPP (LCP):"); break; data/tcpstat-1.5/src/stats.c:368:6: [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(str, "PPP (CCP):"); break; data/tcpstat-1.5/src/stats.c:370:6: [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(str, "PPP (PAP):"); break; data/tcpstat-1.5/src/stats.c:372:6: [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(str, "PPP (CHAP):"); break; data/tcpstat-1.5/src/stats.c:374:6: [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(str, "PPP (other):"); break; data/tcpstat-1.5/src/stats.c:380:6: [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(str, "No Link (IP):"); break; data/tcpstat-1.5/src/stats.c:383:6: [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(str, "No Link (IPv6):"); break; data/tcpstat-1.5/src/stats.c:386:6: [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(str, "No Link (non-IP):"); break; data/tcpstat-1.5/src/stats.c:391:6: [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(str, "UNKNOWN (IP):"); data/tcpstat-1.5/src/stats.c:393:6: [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(str, "UNKNWON (non-IP):"); data/tcpstat-1.5/src/stats.c:509:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy((void *)&su, (void *)&(*sia)[count-1].unit, sizeof(stat_unit)); data/tcpstat-1.5/src/stats.c:510:3: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. bcopy(&key, &(*sia)[count-1].key, sizeof(stkey_t)); data/tcpstat-1.5/src/tcpprof.c:33: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 filterexpr[BUF_SIZ] = ""; data/tcpstat-1.5/src/tcpprof.c:112: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 filename[BUF_SIZ]; data/tcpstat-1.5/src/tcpstat.c:103: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 s[BUF_SIZ]; data/tcpstat-1.5/src/tcpstat.c:120: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 s[BUF_SIZ]; data/tcpstat-1.5/src/tcpstat.c:150: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 printval_str[BUF_SIZ]; data/tcpstat-1.5/lib/process.c:68:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = (int)read(fd, magics, MAGIC_SIZE*sizeof(u_int) ); data/tcpstat-1.5/lib/process.c:258:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(fd, &fh, sizeof(fh) ); data/tcpstat-1.5/lib/process.c:282:22: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( (len = (int)read(fd, &ph, sizeof(ph))) != 0) { data/tcpstat-1.5/lib/process.c:293:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = (int)read(fd, packet, blen); data/tcpstat-1.5/lib/process.c:326:5: [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(fname) == strlen("auto") && data/tcpstat-1.5/lib/process.c:326: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). (strlen(fname) == strlen("auto") && data/tcpstat-1.5/lib/process.c:392:8: [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(fname) != 1 || *fname != '-') && data/tcpstat-1.5/lib/utils.c:87: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). if (!*s || strlen(s) < 2) return p; data/tcpstat-1.5/lib/utils.c:89:12: [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). for (s += strlen(p); s>p && *s != '/'; s--) continue; data/tcpstat-1.5/lib/utils.c:135: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). n = strlen(src)*sizeof(char); data/tcpstat-1.5/lib/utils.c:146:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. return strncat(*dst, src, n); data/tcpstat-1.5/src/catpcap.c:159:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filterexpr, optarg, BUF_SIZ); data/tcpstat-1.5/src/catpcap.c:162:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, optarg, BUF_SIZ); data/tcpstat-1.5/src/dump.c:112:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filterexpr, optarg, BUF_SIZ); data/tcpstat-1.5/src/dump.c:115:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, optarg, BUF_SIZ); data/tcpstat-1.5/src/stats.c:436:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, he->h_name, FIRST_COLUMN_WIDTH - 1 data/tcpstat-1.5/src/tcpprof.c:129:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filterexpr, optarg, BUF_SIZ); data/tcpstat-1.5/src/tcpprof.c:132:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, optarg, BUF_SIZ); data/tcpstat-1.5/src/tcpprof.c:136:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(filename, optarg, BUF_SIZ); data/tcpstat-1.5/src/tcpprof.c:169:26: [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 (filename == NULL || strlen(filename) < 1) { data/tcpstat-1.5/src/tcpprof.c:170:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(filename, "auto", BUF_SIZ); data/tcpstat-1.5/src/tcpstat.c:112:2: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(s, f, i); data/tcpstat-1.5/src/tcpstat.c:156:32: [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). write(filedesc, printval_str, strlen(printval_str)); \ data/tcpstat-1.5/src/tcpstat.c:252:12: [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). f += strlen(fd_str) - 1; ANALYSIS SUMMARY: Hits = 97 Lines analyzed = 3198 in approximately 0.11 seconds (29612 lines/second) Physical Source Lines of Code (SLOC) = 2219 Hits@level = [0] 106 [1] 24 [2] 54 [3] 4 [4] 15 [5] 0 Hits@level+ = [0+] 203 [1+] 97 [2+] 73 [3+] 19 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 91.4826 [1+] 43.7134 [2+] 32.8977 [3+] 8.56242 [4+] 6.7598 [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.