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/rtmidi-4.0.0/RtMidi.cpp
Examining data/rtmidi-4.0.0/RtMidi.h
Examining data/rtmidi-4.0.0/contrib/go/rtmidi/rtmidi_stub.cpp
Examining data/rtmidi-4.0.0/contrib/go/rtmidi/rtmidi_stub.h
Examining data/rtmidi-4.0.0/doc/doxygen/samples/getting_started.cpp
Examining data/rtmidi-4.0.0/rtmidi_c.cpp
Examining data/rtmidi-4.0.0/rtmidi_c.h
Examining data/rtmidi-4.0.0/tests/apinames.cpp
Examining data/rtmidi-4.0.0/tests/cmidiin.cpp
Examining data/rtmidi-4.0.0/tests/midiclock.cpp
Examining data/rtmidi-4.0.0/tests/midiout.cpp
Examining data/rtmidi-4.0.0/tests/midiprobe.cpp
Examining data/rtmidi-4.0.0/tests/qmidiin.cpp
Examining data/rtmidi-4.0.0/tests/sysextest.cpp

FINAL RESULTS:

data/rtmidi-4.0.0/RtMidi.cpp:2475:7:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
      EnterCriticalSection( &(apiData->_mutex) );
data/rtmidi-4.0.0/RtMidi.cpp:2629:5:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
    EnterCriticalSection( &(data->_mutex) );
data/rtmidi-4.0.0/RtMidi.cpp:1188: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[128];
data/rtmidi-4.0.0/RtMidi.cpp:1263: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[128];
data/rtmidi-4.0.0/RtMidi.cpp:2370:17:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  int wlength = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
data/rtmidi-4.0.0/RtMidi.cpp:2375:5:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
    MultiByteToWideChar( CP_ACP, 0, str, -1, &wstrtemp[0], wlength );
data/rtmidi-4.0.0/rtmidi_c.cpp:54: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(apis, rtmidi_compiled_apis, num * sizeof(enum RtMidiApi));
data/rtmidi-4.0.0/rtmidi_c.cpp:262:13:  [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 (message, v.data (), (int) v.size ());
data/rtmidi-4.0.0/tests/qmidiin.cpp:57:42:  [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).
  if ( argc == 2 ) port = (unsigned int) atoi( argv[1] );
data/rtmidi-4.0.0/tests/sysextest.cpp:52:27:  [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).
  nBytes = (unsigned int) atoi( argv[1] );
data/rtmidi-4.0.0/RtMidi.cpp:1551:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
          int res = read( poll_fds[0].fd, &dummy, sizeof(dummy) );
data/rtmidi-4.0.0/tests/midiclock.cpp:22:33:  [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 SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
data/rtmidi-4.0.0/tests/midiout.cpp:19:33:  [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 SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
data/rtmidi-4.0.0/tests/qmidiin.cpp:21:33:  [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 SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
data/rtmidi-4.0.0/tests/sysextest.cpp:26:33:  [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 SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )

ANALYSIS SUMMARY:

Hits = 15
Lines analyzed = 5670 in approximately 0.13 seconds (42631 lines/second)
Physical Source Lines of Code (SLOC) = 3827
Hits@level = [0]   0 [1]   5 [2]   8 [3]   2 [4]   0 [5]   0
Hits@level+ = [0+]  15 [1+]  15 [2+]  10 [3+]   2 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 3.91952 [1+] 3.91952 [2+] 2.61301 [3+] 0.522603 [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.