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/libcxx-serial-1.2.1/examples/serial_example.cc
Examining data/libcxx-serial-1.2.1/include/serial/impl/unix.h
Examining data/libcxx-serial-1.2.1/include/serial/impl/win.h
Examining data/libcxx-serial-1.2.1/include/serial/v8stdint.h
Examining data/libcxx-serial-1.2.1/include/serial/serial.h
Examining data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc
Examining data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_osx.cc
Examining data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_win.cc
Examining data/libcxx-serial-1.2.1/src/impl/win.cc
Examining data/libcxx-serial-1.2.1/src/impl/unix.cc
Examining data/libcxx-serial-1.2.1/src/serial.cc
Examining data/libcxx-serial-1.2.1/tests/proof_of_concepts/mdc2250.cc
Examining data/libcxx-serial-1.2.1/tests/proof_of_concepts/tokenizer.cc
Examining data/libcxx-serial-1.2.1/tests/unit/unix_timer_tests.cc
Examining data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc

FINAL RESULTS:

data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc:240:28:  [4] (format) vsnprintf:
  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.
        int return_value = vsnprintf(buffer, buffer_size_bytes, format, ap);
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc:40:15:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
static string realpath(const string& path);
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc:112:1:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
realpath(const string& path)
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc:114:23:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
    char* real_path = realpath(path.c_str(), NULL);
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc:160:45:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
        sys_device_path = dirname( dirname( realpath( sys_device_path ) ) );
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_linux.cc:171:36:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
        sys_device_path = dirname( realpath( sys_device_path ) );
data/libcxx-serial-1.2.1/include/serial/impl/unix.h:78:3:  [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).
  open ();
data/libcxx-serial-1.2.1/include/serial/impl/win.h:67:3:  [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).
  open ();
data/libcxx-serial-1.2.1/include/serial/serial.h:211:3:  [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).
  open ();
data/libcxx-serial-1.2.1/include/serial/serial.h:707:7:  [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 error_str [1024];
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_osx.cc:34: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 cstring[MAXPATHLEN];
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_osx.cc:265:13:  [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 cstring[HARDWARE_ID_STRING_LENGTH];
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_win.cc:65:3:  [2] (buffer) TCHAR:
  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.
		TCHAR port_name[port_name_max_length];
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_win.cc:93:3:  [2] (buffer) TCHAR:
  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.
		TCHAR friendly_name[friendly_name_max_length];
data/libcxx-serial-1.2.1/src/impl/list_ports/list_ports_win.cc:112:3:  [2] (buffer) TCHAR:
  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.
		TCHAR hardware_id[hardware_id_max_length];
data/libcxx-serial-1.2.1/src/impl/unix.cc:119:5:  [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).
    open ();
data/libcxx-serial-1.2.1/src/impl/unix.cc:130:21:  [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).
Serial::SerialImpl::open ()
data/libcxx-serial-1.2.1/src/impl/unix.cc:139:11:  [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 (port_.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);
data/libcxx-serial-1.2.1/src/impl/unix.cc:145: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).
      open ();
data/libcxx-serial-1.2.1/src/impl/win.cc:42:5:  [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).
    open ();
data/libcxx-serial-1.2.1/src/impl/win.cc:55:21:  [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).
Serial::SerialImpl::open ()
data/libcxx-serial-1.2.1/src/serial.cc:81: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).
Serial::open ()
data/libcxx-serial-1.2.1/src/serial.cc:83:11:  [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).
  pimpl_->open ();
data/libcxx-serial-1.2.1/src/serial.cc:288:17:  [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 (was_open) open ();
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:67: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 name[100];
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:77: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 buf[5] = "";
data/libcxx-serial-1.2.1/examples/serial_example.cc:43:7:  [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(milliseconds*1000); // 100 ms
data/libcxx-serial-1.2.1/examples/serial_example.cc:118:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    string result = my_serial.read(test_string.length()+1);
data/libcxx-serial-1.2.1/examples/serial_example.cc:134:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    string result = my_serial.read(test_string.length()+1);
data/libcxx-serial-1.2.1/examples/serial_example.cc:149:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    string result = my_serial.read(test_string.length());
data/libcxx-serial-1.2.1/examples/serial_example.cc:164:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    string result = my_serial.read(test_string.length()-1);
data/libcxx-serial-1.2.1/include/serial/impl/unix.h:96:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read (uint8_t *buf, size_t size = 1);
data/libcxx-serial-1.2.1/include/serial/impl/win.h:85:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read (uint8_t *buf, size_t size = 1);
data/libcxx-serial-1.2.1/include/serial/serial.h:271:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read (uint8_t *buffer, size_t size);
data/libcxx-serial-1.2.1/include/serial/serial.h:285:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read (std::vector<uint8_t> &buffer, size_t size = 1);
data/libcxx-serial-1.2.1/include/serial/serial.h:299:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read (std::string &buffer, size_t size = 1);
data/libcxx-serial-1.2.1/include/serial/serial.h:312:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read (size_t size = 1);
data/libcxx-serial-1.2.1/src/impl/unix.cc:533:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Serial::SerialImpl::read (uint8_t *buf, size_t size)
data/libcxx-serial-1.2.1/src/impl/unix.cc:548:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ssize_t bytes_read_now = ::read (fd_, buf, size);
data/libcxx-serial-1.2.1/src/impl/unix.cc:578:11:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        ::read (fd_, buf + bytes_read, size - bytes_read);
data/libcxx-serial-1.2.1/src/impl/unix.cc:924:5:  [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(1000);
data/libcxx-serial-1.2.1/src/impl/win.cc:330:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Serial::SerialImpl::read (uint8_t *buf, size_t size)
data/libcxx-serial-1.2.1/src/serial.cc:120:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  return this->pimpl_->read (buffer, size);
data/libcxx-serial-1.2.1/src/serial.cc:124:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Serial::read (uint8_t *buffer, size_t size)
data/libcxx-serial-1.2.1/src/serial.cc:127:24:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  return this->pimpl_->read (buffer, size);
data/libcxx-serial-1.2.1/src/serial.cc:131:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Serial::read (std::vector<uint8_t> &buffer, size_t size)
data/libcxx-serial-1.2.1/src/serial.cc:138:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    bytes_read = this->pimpl_->read (buffer_, size);
data/libcxx-serial-1.2.1/src/serial.cc:151:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Serial::read (std::string &buffer, size_t size)
data/libcxx-serial-1.2.1/src/serial.cc:157:32:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    bytes_read = this->pimpl_->read (buffer_, size);
data/libcxx-serial-1.2.1/src/serial.cc:169:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
Serial::read (size_t size)
data/libcxx-serial-1.2.1/src/serial.cc:172:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  this->read (buffer, size);
data/libcxx-serial-1.2.1/tests/unit/unix_timer_tests.cc:20:5:  [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(1000 * ms);
data/libcxx-serial-1.2.1/tests/unit/unix_timer_tests.cc:39:5:  [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(1000);
data/libcxx-serial-1.2.1/tests/unit/unix_timer_tests.cc:43:3:  [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(500000);
data/libcxx-serial-1.2.1/tests/unit/unix_timer_tests.cc:50:3:  [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(500000);
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:72:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  string r = port1->read(4);
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:79:3:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  read(master_fd, buf, 4);
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:85:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  string empty = port1->read();
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:90:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  string r = port1->read(4);
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:99:25:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  string empty = port1->read(10);
data/libcxx-serial-1.2.1/tests/unix_serial_tests.cc:104:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  string r = port1->read(4);

ANALYSIS SUMMARY:

Hits = 61
Lines analyzed = 4560 in approximately 0.11 seconds (41247 lines/second)
Physical Source Lines of Code (SLOC) = 3137
Hits@level = [0]   3 [1]  35 [2]  20 [3]   5 [4]   1 [5]   0
Hits@level+ = [0+]  64 [1+]  61 [2+]  26 [3+]   6 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 20.4017 [1+] 19.4453 [2+] 8.28817 [3+] 1.91266 [4+] 0.318776 [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.