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/libftdi-0.20/ftdipp/ftdi.cpp
Examining data/libftdi-0.20/ftdipp/ftdi.hpp
Examining data/libftdi-0.20/examples/baud_test.c
Examining data/libftdi-0.20/examples/simple.c
Examining data/libftdi-0.20/examples/bitbang2.c
Examining data/libftdi-0.20/examples/bitbang_ft2232.c
Examining data/libftdi-0.20/examples/find_all_pp.cpp
Examining data/libftdi-0.20/examples/bitbang_cbus.c
Examining data/libftdi-0.20/examples/find_all.c
Examining data/libftdi-0.20/examples/serial_test.c
Examining data/libftdi-0.20/examples/bitbang.c
Examining data/libftdi-0.20/src/ftdi.h
Examining data/libftdi-0.20/src/ftdi.c

FINAL RESULTS:

data/libftdi-0.20/examples/baud_test.c:68:17:  [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 ((t = getopt (argc, argv, "b:d:p:m:c:")) != -1)
data/libftdi-0.20/examples/bitbang2.c:53:17:  [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 ((t = getopt (argc, argv, "d:")) != -1)
data/libftdi-0.20/examples/serial_test.c:40:17:  [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 ((i = getopt(argc, argv, "i:v:p:b:w::")) != -1)
data/libftdi-0.20/examples/baud_test.c:73:28:  [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).
                datasize = atoi (optarg);
data/libftdi-0.20/examples/baud_test.c:93:24:  [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).
                baud = atoi (optarg);
data/libftdi-0.20/examples/baud_test.c:99:31:  [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).
                txchunksize = atoi (optarg);
data/libftdi-0.20/examples/bitbang.c:14:5:  [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[1];
data/libftdi-0.20/examples/bitbang2.c:58:25:  [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).
                delay = atoi (optarg);
data/libftdi-0.20/examples/bitbang_cbus.c:41: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.
    unsigned char buf[1];
data/libftdi-0.20/examples/bitbang_cbus.c:43: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.
    unsigned char input[10];
data/libftdi-0.20/examples/bitbang_ft2232.c:21:5:  [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[1];
data/libftdi-0.20/examples/find_all.c:16:5:  [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 manufacturer[128], description[128];
data/libftdi-0.20/examples/find_all_pp.cpp:57:16:  [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(it->open() == 0)
data/libftdi-0.20/examples/serial_test.c:30: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.
    unsigned char buf[1024];
data/libftdi-0.20/ftdipp/ftdi.cpp:39:33:  [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).
            :  ftdi(0), dev(0), open(false)
data/libftdi-0.20/ftdipp/ftdi.cpp:46: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).
        if (open)
data/libftdi-0.20/ftdipp/ftdi.cpp:52:10:  [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).
    bool open;
data/libftdi-0.20/ftdipp/ftdi.cpp:77:15:  [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).
    return d->open;
data/libftdi-0.20/ftdipp/ftdi.cpp:80:14:  [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).
int Context::open(int vendor, int product)
data/libftdi-0.20/ftdipp/ftdi.cpp:91:14:  [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).
int Context::open(int vendor, int product, const std::string& description, const std::string& serial, unsigned int index)
data/libftdi-0.20/ftdipp/ftdi.cpp:110:14:  [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).
int Context::open(const std::string& description)
data/libftdi-0.20/ftdipp/ftdi.cpp:120:14:  [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).
int Context::open(struct usb_device *dev)
data/libftdi-0.20/ftdipp/ftdi.cpp:307:5:  [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 vendor[512], desc[512], serial[512];
data/libftdi-0.20/ftdipp/ftdi.hpp:82: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).
    int open(struct usb_device *dev = 0);
data/libftdi-0.20/ftdipp/ftdi.hpp:83: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).
    int open(int vendor, int product);
data/libftdi-0.20/ftdipp/ftdi.hpp:84: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).
    int open(int vendor, int product, const std::string& description, const std::string& serial = std::string(), unsigned int index=0);
data/libftdi-0.20/ftdipp/ftdi.hpp:85: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).
    int open(const std::string& description);
data/libftdi-0.20/src/ftdi.c:643:5:  [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 string[256];
data/libftdi-0.20/src/ftdi.c:972:18:  [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 am_adjust_up[8] = {0, 0, 0, 1, 0, 3, 2, 1};
data/libftdi-0.20/src/ftdi.c:973:18:  [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 am_adjust_dn[8] = {0, 0, 0, 1, 0, 1, 2, 3};
data/libftdi-0.20/src/ftdi.c:974:18:  [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 frac_code[8] = {0, 3, 2, 4, 1, 5, 6, 7};
data/libftdi-0.20/src/ftdi.c:1554: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 (buf, ftdi->readbuffer+ftdi->readbuffer_offset, size);
data/libftdi-0.20/src/ftdi.c:1567: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 (buf, ftdi->readbuffer+ftdi->readbuffer_offset, ftdi->readbuffer_remaining);
data/libftdi-0.20/src/ftdi.c:1620:17:  [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+offset, ftdi->readbuffer+ftdi->readbuffer_offset, ret);
data/libftdi-0.20/src/ftdi.c:1634:17:  [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+offset, ftdi->readbuffer+ftdi->readbuffer_offset, part_size);
data/libftdi-0.20/src/ftdi.c:1904:5:  [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 usb_val[2];
data/libftdi-0.20/examples/bitbang2.c:35:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
#define usleep(x) Sleep((x+999)/1000)
data/libftdi-0.20/examples/bitbang2.c:84:9:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
        usleep(delay);
data/libftdi-0.20/ftdipp/ftdi.cpp:180:14:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
int Context::read(unsigned char *buf, int size)
data/libftdi-0.20/ftdipp/ftdi.cpp:421:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
int Eeprom::read(unsigned char *eeprom)
data/libftdi-0.20/ftdipp/ftdi.hpp:98:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int read(unsigned char *buf, int size);
data/libftdi-0.20/ftdipp/ftdi.hpp:161:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    int read(unsigned char *eeprom);
data/libftdi-0.20/src/ftdi.c:765: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).
                size_t len = strlen(bus->dirname);
data/libftdi-0.20/src/ftdi.c:2204:29:  [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).
        manufacturer_size = strlen(eeprom->manufacturer);
data/libftdi-0.20/src/ftdi.c:2206: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).
        product_size = strlen(eeprom->product);
data/libftdi-0.20/src/ftdi.c:2208:23:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
        serial_size = strlen(eeprom->serial);

ANALYSIS SUMMARY:

Hits = 46
Lines analyzed = 5078 in approximately 0.19 seconds (26503 lines/second)
Physical Source Lines of Code (SLOC) = 3011
Hits@level = [0]  77 [1]  10 [2]  33 [3]   3 [4]   0 [5]   0
Hits@level+ = [0+] 123 [1+]  46 [2+]  36 [3+]   3 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 40.8502 [1+] 15.2773 [2+] 11.9562 [3+] 0.996347 [4+]   0 [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.