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/pcapfix-1.1.4/pcap.c
Examining data/pcapfix-1.1.4/pcap.h
Examining data/pcapfix-1.1.4/pcap_kuznet.c
Examining data/pcapfix-1.1.4/pcap_kuznet.h
Examining data/pcapfix-1.1.4/pcapfix.c
Examining data/pcapfix-1.1.4/pcapfix.h
Examining data/pcapfix-1.1.4/pcapng.c
Examining data/pcapfix-1.1.4/pcapng.h

FINAL RESULTS:

data/pcapfix-1.1.4/pcapfix.c:216: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(filename_fix, optarg);
data/pcapfix-1.1.4/pcapfix.c:258:7:  [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(filebname, fileext);
data/pcapfix-1.1.4/pcapfix.c:261:7:  [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(filebname, basename(filename));		/* unix method (basename) */
data/pcapfix-1.1.4/pcapfix.c:267: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(filename_fix, filebname);
data/pcapfix-1.1.4/pcapfix.c:198:15:  [3] (buffer) getopt_long:
  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 ((c = getopt_long(argc, argv, ":t:ko:v::d::s::n::", long_options, &option_index)) != -1) {
data/pcapfix-1.1.4/pcap.c:142: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(hdr, buffer, sizeof(struct packet_hdr_s));
data/pcapfix-1.1.4/pcap.c:161:7:  [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(tmp, buffer, i);
data/pcapfix-1.1.4/pcap.c:162:7:  [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(tmp+i, buffer+i+1, size-i-1);
data/pcapfix-1.1.4/pcap.c:340: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(writebuffer, &global_hdr, sizeof(global_hdr));
data/pcapfix-1.1.4/pcap.c:372:3:  [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 hdrbuffer[sizeof(packet_hdr)*2];		/* the buffer that will be used to find a proper packet */
data/pcapfix-1.1.4/pcap.c:374:3:  [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[PCAP_MAX_SNAPLEN];		/* the packet body */
data/pcapfix-1.1.4/pcap.c:541:7:  [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(writebuffer+writepos, &packet_hdr, sizeof(packet_hdr));
data/pcapfix-1.1.4/pcap.c:543:7:  [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(writebuffer+writepos, buffer, conint(packet_hdr.incl_len));
data/pcapfix-1.1.4/pcap.c:611:11:  [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(writebuffer+writepos, &packet_hdr, sizeof(packet_hdr));
data/pcapfix-1.1.4/pcap.c:613:11:  [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(writebuffer+writepos, buffer, conint(packet_hdr.incl_len));
data/pcapfix-1.1.4/pcap.c:692:15:  [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(writebuffer+writepos, &packet_hdr, sizeof(packet_hdr));
data/pcapfix-1.1.4/pcap.c:694:15:  [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(writebuffer+writepos, buffer, conint(packet_hdr.incl_len));
data/pcapfix-1.1.4/pcap_kuznet.c:135: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(hdr, buffer, sizeof(struct packet_hdr_kuznet_s));
data/pcapfix-1.1.4/pcap_kuznet.c:154:7:  [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(tmp, buffer, i);
data/pcapfix-1.1.4/pcap_kuznet.c:155:7:  [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(tmp+i, buffer+i+1, size-i-1);
data/pcapfix-1.1.4/pcap_kuznet.c:324: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(writebuffer, &global_hdr, sizeof(global_hdr));
data/pcapfix-1.1.4/pcap_kuznet.c:356:3:  [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 hdrbuffer[sizeof(packet_hdr)*2];		/* the buffer that will be used to find a proper packet */
data/pcapfix-1.1.4/pcap_kuznet.c:358:3:  [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[PCAP_MAX_SNAPLEN];		/* the packet body */
data/pcapfix-1.1.4/pcap_kuznet.c:525:7:  [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(writebuffer+writepos, &packet_hdr, sizeof(packet_hdr));
data/pcapfix-1.1.4/pcap_kuznet.c:527:7:  [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(writebuffer+writepos, buffer, conint(packet_hdr.incl_len));
data/pcapfix-1.1.4/pcap_kuznet.c:595:11:  [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(writebuffer+writepos, &packet_hdr, sizeof(packet_hdr));
data/pcapfix-1.1.4/pcap_kuznet.c:597:11:  [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(writebuffer+writepos, buffer, conint(packet_hdr.incl_len));
data/pcapfix-1.1.4/pcap_kuznet.c:676:15:  [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(writebuffer+writepos, &packet_hdr, sizeof(packet_hdr));
data/pcapfix-1.1.4/pcap_kuznet.c:678:15:  [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(writebuffer+writepos, buffer, conint(packet_hdr.incl_len));
data/pcapfix-1.1.4/pcapfix.c:219:26:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
        data_link_type = atoi(optarg);
data/pcapfix-1.1.4/pcapfix.c:243: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).
  pcap = fopen(filename, "rb");
data/pcapfix-1.1.4/pcapfix.c:266:5:  [2] (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). Risk is low because the source is a constant string.
    strcpy(filename_fix, "fixed_");
data/pcapfix-1.1.4/pcapfix.c:275:55:  [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).
  if (strcmp(filename, filename_fix) == 0) pcap_fix = fopen(filename_fix, "rb+");
data/pcapfix-1.1.4/pcapfix.c:276:19:  [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).
  else pcap_fix = fopen(filename_fix, "w+");
data/pcapfix-1.1.4/pcapng.c:213: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(new_block, &bh, 8);
data/pcapfix-1.1.4/pcapng.c:268:9:  [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(new_block+block_pos, &shb, sizeof(shb));
data/pcapfix-1.1.4/pcapng.c:356:11:  [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(new_block+block_pos, &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:368:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:429:9:  [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(new_block+block_pos, &pb, sizeof(pb));
data/pcapfix-1.1.4/pcapng.c:448:9:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:536:11:  [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(new_block+block_pos, &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:548:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:584:9:  [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(new_block+block_pos, &spb, sizeof(spb));
data/pcapfix-1.1.4/pcapng.c:599:9:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:629:9:  [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(new_block+block_pos, &idb, sizeof(idb));
data/pcapfix-1.1.4/pcapng.c:758:11:  [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(new_block+block_pos, &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:770:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:847:11:  [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(new_block+block_pos, &nrb, sizeof(nrb));
data/pcapfix-1.1.4/pcapng.c:863:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:959:11:  [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(new_block+block_pos, &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:971:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:1004:9:  [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(new_block+block_pos, &isb, sizeof(isb));
data/pcapfix-1.1.4/pcapng.c:1109:11:  [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(new_block+block_pos, &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:1121:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:1189:9:  [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(new_block+block_pos, &epb, sizeof(epb));
data/pcapfix-1.1.4/pcapng.c:1207:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:1300:11:  [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(new_block+block_pos, &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:1312:11:  [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(new_block+block_pos, data, padding);
data/pcapfix-1.1.4/pcapng.c:1338:7:  [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(new_block+4, &block_pos, sizeof(bh.total_length));
data/pcapfix-1.1.4/pcapng.c:1339:7:  [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(new_block+block_pos-4, &block_pos, sizeof(bh.total_length));
data/pcapfix-1.1.4/pcapng.c:1361:7:  [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(writebuffer+writepos, new_block, block_pos);
data/pcapfix-1.1.4/pcapng.c:1606: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(data, &bh, sizeof(bh));
data/pcapfix-1.1.4/pcapng.c:1608: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(data+sizeof(bh), &shb, sizeof(shb));
data/pcapfix-1.1.4/pcapng.c:1610: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(data+sizeof(bh)+sizeof(shb), &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:1612: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(data+sizeof(bh)+sizeof(shb)+sizeof(oh), comment, padding);
data/pcapfix-1.1.4/pcapng.c:1616: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(data+sizeof(bh)+sizeof(shb)+sizeof(oh)+padding+4, &size, sizeof(size));
data/pcapfix-1.1.4/pcapng.c:1628: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(writebuffer+(*writepos), data, size);
data/pcapfix-1.1.4/pcapng.c:1715: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(data, &bh, sizeof(bh));
data/pcapfix-1.1.4/pcapng.c:1717: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(data+sizeof(bh), &idb, sizeof(idb));
data/pcapfix-1.1.4/pcapng.c:1719: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(data+sizeof(bh)+sizeof(idb), &oh, sizeof(oh));
data/pcapfix-1.1.4/pcapng.c:1721: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(data+sizeof(bh)+sizeof(idb)+sizeof(oh), comment, padding);
data/pcapfix-1.1.4/pcapng.c:1725: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(data+sizeof(bh)+sizeof(idb)+sizeof(oh)+padding+4, &size, sizeof(size));
data/pcapfix-1.1.4/pcapng.c:1737: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(writebuffer+(*writepos), data, size);
data/pcapfix-1.1.4/pcapfix.c:215:31:  [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_fix = malloc(strlen(optarg)+1);
data/pcapfix-1.1.4/pcapfix.c:254: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).
    filebname = malloc(strlen(filename)+1);
data/pcapfix-1.1.4/pcapfix.c:256:30:  [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).
      char *fileext = malloc(strlen(filename));   /* file extention to be used in output file as well */
data/pcapfix-1.1.4/pcapfix.c:263:27:  [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_fix = malloc(strlen(filebname)+7);	/* size of outputfile depends on inputfile's length */
data/pcapfix-1.1.4/pcapng.c:1581: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).
  oh.option_length = strlen(comment);   /* size equals the definied comment */
data/pcapfix-1.1.4/pcapng.c:1690: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).
  oh.option_length = strlen(comment);   /* size equals the definied comment */

ANALYSIS SUMMARY:

Hits = 79
Lines analyzed = 4273 in approximately 0.18 seconds (24098 lines/second)
Physical Source Lines of Code (SLOC) = 2006
Hits@level = [0] 316 [1]   6 [2]  68 [3]   1 [4]   4 [5]   0
Hits@level+ = [0+] 395 [1+]  79 [2+]  73 [3+]   5 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 196.909 [1+] 39.3819 [2+] 36.3908 [3+] 2.49252 [4+] 1.99402 [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.