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/portmidi-217/pm_test/midithread.c
Examining data/portmidi-217/pm_test/qtest.c
Examining data/portmidi-217/pm_test/midithru.c
Examining data/portmidi-217/pm_test/simple_test.c
Examining data/portmidi-217/pm_test/latency.c
Examining data/portmidi-217/pm_test/mm.c
Examining data/portmidi-217/pm_test/midiclock.c
Examining data/portmidi-217/pm_test/sysex.c
Examining data/portmidi-217/pm_java/pmjni/pmjni.c
Examining data/portmidi-217/pm_java/pmjni/jportmidi_JportMidiApi.h
Examining data/portmidi-217/pm_common/portmidi.h
Examining data/portmidi-217/pm_common/pmutil.c
Examining data/portmidi-217/pm_common/pmutil.h
Examining data/portmidi-217/pm_common/pminternal.h
Examining data/portmidi-217/pm_common/portmidi.c
Examining data/portmidi-217/pm_win/pmwinmm.h
Examining data/portmidi-217/pm_win/pmwinmm.c
Examining data/portmidi-217/pm_win/pmwin.c
Examining data/portmidi-217/pm_mac/pmmac.h
Examining data/portmidi-217/pm_mac/pmmac.c
Examining data/portmidi-217/pm_mac/finddefault.c
Examining data/portmidi-217/pm_mac/pmmacosxcm.c
Examining data/portmidi-217/pm_mac/readbinaryplist.h
Examining data/portmidi-217/pm_mac/pmmacosxcm.h
Examining data/portmidi-217/pm_mac/readbinaryplist.c
Examining data/portmidi-217/pm_linux/pmlinuxalsa.h
Examining data/portmidi-217/pm_linux/pmlinux.h
Examining data/portmidi-217/pm_linux/finddefault.c
Examining data/portmidi-217/pm_linux/pmlinux.c
Examining data/portmidi-217/pm_linux/pmlinuxalsa.c
Examining data/portmidi-217/porttime/ptmacosx_cf.c
Examining data/portmidi-217/porttime/porttime.h
Examining data/portmidi-217/porttime/porttime.c
Examining data/portmidi-217/porttime/ptmacosx_mach.c
Examining data/portmidi-217/porttime/ptwinmm.c
Examining data/portmidi-217/porttime/ptlinux.c
Examining data/portmidi-217/pm_csharp/pm_managed/Stdafx.h
Examining data/portmidi-217/pm_csharp/pm_managed/AssemblyInfo.cpp
Examining data/portmidi-217/pm_csharp/pm_managed/pm_managed.cpp
Examining data/portmidi-217/pm_csharp/pm_managed/pm_managed.h
Examining data/portmidi-217/pm_csharp/pm_managed/Stdafx.cpp
Examining data/portmidi-217/pm_csharp/pm_managed/resource.h
Examining data/portmidi-217/pm_python/pyportmidi/_pyportmidi.c

FINAL RESULTS:

data/portmidi-217/pm_linux/finddefault.c:51:5:  [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(full_name, pref_1); 
data/portmidi-217/pm_linux/finddefault.c:52: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(full_name, pref_2);
data/portmidi-217/pm_linux/finddefault.c:64: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(full_name, pref_3);
data/portmidi-217/pm_linux/pmlinuxalsa.c:64:9:  [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(msg, snd_strerror(err));
data/portmidi-217/pm_linux/pmlinuxalsa.c:717:5:  [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(dup, s);
data/portmidi-217/pm_mac/pmmacosxcm.c:999:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(pm_hosterror_text, "Host error %ld: %s\n", (long) macHostError, 
data/portmidi-217/pm_mac/readbinaryplist.c:109:24:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    #define bplist_log printf
data/portmidi-217/pm_test/mm.c:330:17:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
                printf(vel_format + len, Pm_MessageData2(data));
data/portmidi-217/pm_test/mm.c:339:13:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            printf(vel_format + len, Pm_MessageData2(data));
data/portmidi-217/pm_test/mm.c:396:13:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            printf(val_format + len, Pm_MessageData2(data));
data/portmidi-217/pm_test/mm.c:486:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(result, "%s%d", ptos[p % 12], (p / 12) - 1);
data/portmidi-217/pm_linux/finddefault.c:43:20:  [3] (buffer) getenv:
  Environment variables are untrustable input if they can be set by an
  attacker. They can have any content and length, and the same variable can
  be set more than once (CWE-807, CWE-20). Check environment variables
  carefully before using them.
    char *pref_1 = getenv("HOME");
data/portmidi-217/pm_test/sysex.c:90:5:  [3] (random) srand:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    srand((unsigned int) Pt_Time()); /* seed for random numbers */
data/portmidi-217/pm_win/pmwinmm.c:692:9:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
        EnterCriticalSection(&m->lock);
data/portmidi-217/pm_win/pmwinmm.c:725:9:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
        EnterCriticalSection(&m->lock);
data/portmidi-217/pm_common/pminternal.h:32:8:  [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.
extern char pm_hosterror_text[PM_HOST_ERROR_MSG_LEN];
data/portmidi-217/pm_common/pminternal.h:71: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).
    pm_open_fn open;   /* open MIDI device */
data/portmidi-217/pm_common/pmutil.c:104: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(msg, queue->peek, (queue->msg_size - 1) * sizeof(int32_t));
data/portmidi-217/pm_common/pmutil.c:141: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(msg, (char *) &queue->buffer[head + 1], 
data/portmidi-217/pm_common/portmidi.c:44: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 pm_hosterror_text[PM_HOST_ERROR_MSG_LEN];
data/portmidi-217/pm_common/portmidi.c:54: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 line[STRING_MAX];
data/portmidi-217/pm_common/portmidi.c:109: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(new_descriptors, descriptors, 
data/portmidi-217/pm_common/portmidi.c:731:31:  [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).
    err = (*midi->dictionary->open)(midi, inputDriverInfo);
data/portmidi-217/pm_common/portmidi.c:812:31:  [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).
    err = (*midi->dictionary->open)(midi, outputDriverInfo);
data/portmidi-217/pm_java/pmjni/pmjni.c:71: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 msg[PM_HOST_ERROR_MSG_LEN];
data/portmidi-217/pm_linux/finddefault.c:59: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(full_name + offset, path, path_ptr - path);
data/portmidi-217/pm_linux/finddefault.c:65:11:  [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).
    inf = fopen(full_name, "r");
data/portmidi-217/pm_linux/finddefault.c:71: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.
        char pref_str[STRING_MAX];
data/portmidi-217/pm_linux/pmlinuxalsa.c:66:9:  [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(msg, "Alsa error %d", err);
data/portmidi-217/pm_linux/pmlinuxalsa.c:68:9:  [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(msg, "Alsa");
data/portmidi-217/pm_mac/pmmacosxcm.c:100: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 error[PM_HOST_ERROR_MSG_LEN];
data/portmidi-217/pm_mac/pmmacosxcm.c:101: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 callback_error[PM_HOST_ERROR_MSG_LEN];
data/portmidi-217/pm_mac/pmmacosxcm.c:363:9:  [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(pm_hosterror_text, 
data/portmidi-217/pm_mac/pmmacosxcm.c:394:9:  [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(pm_hosterror_text, 
data/portmidi-217/pm_mac/pmmacosxcm.c:461:9:  [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(pm_hosterror_text,
data/portmidi-217/pm_mac/pmmacosxcm.c:497:5:  [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(pm_hosterror_text, 
data/portmidi-217/pm_mac/readbinaryplist.c:184: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.
static const char kHEADER_BYTES[kHEADER_SIZE] = "bplist00";
data/portmidi-217/pm_mac/readbinaryplist.c:248: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(v->string, s, len);
data/portmidi-217/pm_mac/readbinaryplist.c:255: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(v->string, s, len);
data/portmidi-217/pm_mac/readbinaryplist.c:270: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(pldata->data, data, len);
data/portmidi-217/pm_mac/readbinaryplist.c:365:12:  [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).
    file = fopen(filename, "rb");
data/portmidi-217/pm_mac/readbinaryplist.c:384: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 cstr[MAXPATHLEN];
data/portmidi-217/pm_mac/readbinaryplist.c:1020: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 key[MAX_KEY_SIZE];
data/portmidi-217/pm_test/latency.c:160: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 line[STRING_MAX];
data/portmidi-217/pm_test/latency.c:281: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 line[STRING_MAX];
data/portmidi-217/pm_test/midiclock.c:168: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 line[STRING_MAX];
data/portmidi-217/pm_test/midiclock.c:239: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 s[STRING_MAX]; /* console input */
data/portmidi-217/pm_test/midithread.c:167: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 line[STRING_MAX];
data/portmidi-217/pm_test/midithread.c:178: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 line[STRING_MAX];
data/portmidi-217/pm_test/midithru.c:225: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 line[STRING_MAX];
data/portmidi-217/pm_test/mm.c:120: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 line[STRING_MAX];
data/portmidi-217/pm_test/mm.c:180: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.
        char s[100];
data/portmidi-217/pm_test/mm.c:481: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 result[8];
data/portmidi-217/pm_test/simple_test.c:38: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 line[STRING_MAX];
data/portmidi-217/pm_test/simple_test.c:118: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 line[80];
data/portmidi-217/pm_test/simple_test.c:284: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 line[80];
data/portmidi-217/pm_test/simple_test.c:384: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 line[STRING_MAX];
data/portmidi-217/pm_test/simple_test.c:399:23:  [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).
            latency = atoi(argv[i]);
data/portmidi-217/pm_test/sysex.c:40: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 line[STRING_MAX];
data/portmidi-217/pm_test/sysex.c:60: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 msg[1024];
data/portmidi-217/pm_test/sysex.c:61: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 line[80];
data/portmidi-217/pm_test/sysex.c:192: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 msg[1024];
data/portmidi-217/pm_test/sysex.c:240:17:  [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 unsigned char receive_msg[MAX_MSG_LEN];
data/portmidi-217/pm_test/sysex.c:366: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 line[80];
data/portmidi-217/pm_test/sysex.c:385:9:  [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).
    f = fopen(line, "w");
data/portmidi-217/pm_test/sysex.c:427: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 line[80];
data/portmidi-217/pm_test/sysex.c:450:9:  [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).
    f = fopen(line, "r");
data/portmidi-217/pm_test/sysex.c:491: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 line[80];
data/portmidi-217/pm_win/pmwin.c:34: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.
        char line[STRING_MAX];
data/portmidi-217/pm_win/pmwin.c:64: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 pattern[PATTERN_MAX];
data/portmidi-217/pm_win/pmwinmm.c:446: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(new_buffers, m->buffers, 
data/portmidi-217/pm_win/pmwinmm.c:502: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(big->lpData, m->hdr->lpData, old_size);
data/portmidi-217/pm_win/pmwinmm.c:1072: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(big->lpData, msg_buffer, m->sysex_byte_count);
data/portmidi-217/pm_win/pmwinmm.c:1420: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 msg[PM_HOST_ERROR_MSG_LEN];
data/portmidi-217/pm_common/portmidi.c:298:9:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
        strncpy(msg, (char *) pm_hosterror_text, len);
data/portmidi-217/pm_linux/finddefault.c:19:24:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while (isspace(c = getc(inf))) ;
data/portmidi-217/pm_linux/finddefault.c:27:24:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while (*s && *s == getc(inf)) s++;
data/portmidi-217/pm_linux/finddefault.c:49:25:  [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).
    full_name  = malloc(strlen(pref_1) + strlen(pref_2) + strlen(pref_3) +
data/portmidi-217/pm_linux/finddefault.c:49:42:  [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).
    full_name  = malloc(strlen(pref_1) + strlen(pref_2) + strlen(pref_3) +
data/portmidi-217/pm_linux/finddefault.c:49:59:  [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).
    full_name  = malloc(strlen(pref_1) + strlen(pref_2) + strlen(pref_3) +
data/portmidi-217/pm_linux/finddefault.c:50:25:  [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(path) + 2);
data/portmidi-217/pm_linux/finddefault.c:58: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).
        int offset = strlen(full_name);
data/portmidi-217/pm_linux/finddefault.c:70:17:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while ((c = getc(inf)) != EOF) {
data/portmidi-217/pm_linux/finddefault.c:75:13:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (getc(inf) != '"') continue; // path not found, keep scanning
data/portmidi-217/pm_linux/finddefault.c:81:22:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            if ((c = getc(inf)) == '"') break;
data/portmidi-217/pm_linux/pmlinuxalsa.c:62:18:  [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).
    int errlen = strlen(snd_strerror(err));
data/portmidi-217/pm_linux/pmlinuxalsa.c:715:15:  [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).
    int len = strlen(s);
data/portmidi-217/pm_mac/pmmacosxcm.c:484:13:  [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((useconds_t) 
data/portmidi-217/pm_mac/pmmacosxcm.c:676:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy(msg, m->error, len);
data/portmidi-217/pm_mac/pmmacosxcm.c:679:13:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
            strncpy(msg, m->callback_error, len);
data/portmidi-217/pm_test/midithread.c:271:15:  [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).
        len = strlen(line);
data/portmidi-217/pm_test/mm.c:488: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).
    return strlen(result);
data/portmidi-217/pm_test/sysex.c:21:18:  [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(n) usleep(n * 1000)
data/portmidi-217/pm_test/sysex.c:384:9:  [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(line) > 0) line[strlen(line) - 1] = 0;
data/portmidi-217/pm_test/sysex.c:384: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).
    if (strlen(line) > 0) line[strlen(line) - 1] = 0;
data/portmidi-217/pm_test/sysex.c:449:9:  [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(line) > 0) line[strlen(line) - 1] = 0;
data/portmidi-217/pm_test/sysex.c:449: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).
    if (strlen(line) > 0) line[strlen(line) - 1] = 0;
data/portmidi-217/pm_win/pmwinmm.c:263:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(dst, src, len);
data/portmidi-217/pm_win/pmwinmm.c:266: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).
    return strlen(dst);
data/portmidi-217/porttime/ptlinux.c:134: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(duration * 1000);
data/portmidi-217/porttime/ptmacosx_cf.c:139: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(duration * 1000);
data/portmidi-217/porttime/ptmacosx_mach.c:130: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(duration * 1000);

ANALYSIS SUMMARY:

Hits = 102
Lines analyzed = 17332 in approximately 0.49 seconds (35619 lines/second)
Physical Source Lines of Code (SLOC) = 11710
Hits@level = [0] 287 [1]  28 [2]  59 [3]   4 [4]  11 [5]   0
Hits@level+ = [0+] 389 [1+] 102 [2+]  74 [3+]  15 [4+]  11 [5+]   0
Hits/KSLOC@level+ = [0+] 33.2195 [1+] 8.7105 [2+] 6.31939 [3+] 1.28096 [4+] 0.939368 [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.