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/playmidi-2.4debian/gmvoices.h
Examining data/playmidi-2.4debian/emumidi.c
Examining data/playmidi-2.4debian/toy.c
Examining data/playmidi-2.4debian/emumidi.h
Examining data/playmidi-2.4debian/seq2mid.c
Examining data/playmidi-2.4debian/beat.c
Examining data/playmidi-2.4debian/gsvoices.h
Examining data/playmidi-2.4debian/awe_voice.h
Examining data/playmidi-2.4debian/bitmaps.h
Examining data/playmidi-2.4debian/io_gtk.c
Examining data/playmidi-2.4debian/io_ncurses.c
Examining data/playmidi-2.4debian/io_svgalib.c
Examining data/playmidi-2.4debian/io_xaw.c
Examining data/playmidi-2.4debian/patchload.c
Examining data/playmidi-2.4debian/playevents.c
Examining data/playmidi-2.4debian/playmidi.c
Examining data/playmidi-2.4debian/readmidi.c

FINAL RESULTS:

data/playmidi-2.4debian/io_gtk.c:240:6:  [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(textbuf);
data/playmidi-2.4debian/io_gtk.c:269:3:  [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(textbuf);
data/playmidi-2.4debian/patchload.c:117:5:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
    sprintf(name, PATCH_PATH1 "/%s.pat", gmvoice[pgm]);
data/playmidi-2.4debian/patchload.c:120:2:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
	sprintf(name, PATCH_PATH2 "/%s.pat", gmvoice[pgm]);
data/playmidi-2.4debian/patchload.c:122:6:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
	    sprintf(name, PATCH_PATH3 "/%s.pat", gmvoice[pgm]);
data/playmidi-2.4debian/playmidi.c:116:7:  [4] (shell) execvp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
      execvp (cmd, args);
data/playmidi-2.4debian/patchload.c:344: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(getpid());
data/playmidi-2.4debian/playmidi.c:267: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,
data/playmidi-2.4debian/toy.c:101: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, "c:p:wt:")) != -1)
data/playmidi-2.4debian/awe_voice.h:65: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 data[0];
data/playmidi-2.4debian/awe_voice.h:93: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 name[AWE_PATCH_NAME_LEN];
data/playmidi-2.4debian/beat.c:22:9:  [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).
    i = atoi(argv[1]);
data/playmidi-2.4debian/gmvoices.h:17: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 *gmvoice[256] = {
data/playmidi-2.4debian/gsvoices.h:6: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 *gsvoice[128] = {
data/playmidi-2.4debian/io_gtk.c:27: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 *filename, *gmvoice[256];
data/playmidi-2.4debian/io_gtk.c:72: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 textbuf[TEXTSIZE];
data/playmidi-2.4debian/io_gtk.c:77: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 *drumset[11] =
data/playmidi-2.4debian/io_gtk.c:179:7:  [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(textbuf, "%02d:%02d.%d", sec / 60, sec % 60, usec);
data/playmidi-2.4debian/io_gtk.c:263:6:  [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(textbuf, "Sysex(%2x): ", cmd);
data/playmidi-2.4debian/io_gtk.c:265:3:  [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(TEXTBUF, "%02x", data[i]);
data/playmidi-2.4debian/io_gtk.c:284: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(textbuf, "channel%02d", i + 1);
data/playmidi-2.4debian/io_gtk.c:321: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(textbuf, "channel%02d", i + 1);
data/playmidi-2.4debian/io_gtk.c:329: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(textbuf, "meter%02d", i + 1);
data/playmidi-2.4debian/io_ncurses.c:24: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 *metatype[7] =
data/playmidi-2.4debian/io_ncurses.c:28: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 *sharps[12] =		/* for a sharp key */
data/playmidi-2.4debian/io_ncurses.c:30: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 *flats[12] =		/* for a flat key */
data/playmidi-2.4debian/io_ncurses.c:32: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 *majflat[15] =		/* name of major key with 'x' flats */
data/playmidi-2.4debian/io_ncurses.c:35: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 *majsharp[15] =		/* name of major key with 'x' sharps */
data/playmidi-2.4debian/io_ncurses.c:38: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 *minflat[15] =		/* name of minor key with 'x' flats */
data/playmidi-2.4debian/io_ncurses.c:41: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 *minsharp[15] =		/* name of minor key with 'x' sharps */
data/playmidi-2.4debian/io_ncurses.c:45: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 *drumset[11] =
data/playmidi-2.4debian/io_ncurses.c:60: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 *filename, *gmvoice[256];
data/playmidi-2.4debian/io_ncurses.c:66: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 textbuf[1024], **nn;
data/playmidi-2.4debian/io_svgalib.c:28: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 *drum3ch[11] =
data/playmidi-2.4debian/io_svgalib.c:42: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 *filename, *gmvoice[256];
data/playmidi-2.4debian/io_svgalib.c:47: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 textbuf[1024], **nn;
data/playmidi-2.4debian/io_svgalib.c:105:3:  [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(textbuf, "skew=%0.2f", skew);
data/playmidi-2.4debian/io_svgalib.c:112:3:  [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(textbuf, "skew=%0.2f", skew);
data/playmidi-2.4debian/io_svgalib.c:143:2:  [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(textbuf, "%02d:%02d.%d", d1 / 60, d1 % 60, d2 / 100000);
data/playmidi-2.4debian/io_svgalib.c:224:6:  [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(textbuf, "Sysex(%2x)", cmd);
data/playmidi-2.4debian/io_svgalib.c:227:3:  [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(textbuf, "%02x", data[i]);
data/playmidi-2.4debian/io_svgalib.c:231:3:  [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(textbuf, "%02x", data[i]);
data/playmidi-2.4debian/io_svgalib.c:235:3:  [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(textbuf, "%02x", data[i]);
data/playmidi-2.4debian/io_svgalib.c:259: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(textbuf, "%d track%c", ntrks, ntrks > 1 ? 's' : ' ');
data/playmidi-2.4debian/io_svgalib.c:270: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).
    mytty = open("/dev/tty", O_RDONLY | O_NDELAY, 0);
data/playmidi-2.4debian/io_xaw.c:35: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 *filename, *gmvoice[256];
data/playmidi-2.4debian/io_xaw.c:63: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 textbuf[TEXTSIZE];
data/playmidi-2.4debian/io_xaw.c:68: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 *drumset[11] =
data/playmidi-2.4debian/io_xaw.c:138: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(textbuf, "%1.2f", skew);
data/playmidi-2.4debian/io_xaw.c:161: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(textbuf, "%1.2f", skew);
data/playmidi-2.4debian/io_xaw.c:224: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(textbuf, "%02d:%02d.%d", sec / 60, sec % 60, usec);
data/playmidi-2.4debian/io_xaw.c:323:6:  [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(textbuf, "Sysex(%2x): ", cmd);
data/playmidi-2.4debian/io_xaw.c:325:3:  [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(TEXTBUF, "%02x", data[i]);
data/playmidi-2.4debian/io_xaw.c:343: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(textbuf, "%1.2f", skew);
data/playmidi-2.4debian/io_xaw.c:351:2:  [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(textbuf, "channel%02d", i + 1);
data/playmidi-2.4debian/io_xaw.c:390:2:  [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(textbuf, "channel%02d", i + 1);
data/playmidi-2.4debian/io_xaw.c:400:2:  [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(textbuf, "meter%02d", i + 1);
data/playmidi-2.4debian/patchload.c:39: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 magic[12];
data/playmidi-2.4debian/patchload.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 version[10];
data/playmidi-2.4debian/patchload.c:41: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 description[60];
data/playmidi-2.4debian/patchload.c:51: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 name[7];
data/playmidi-2.4debian/patchload.c:63: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 envelope_rate[6];
data/playmidi-2.4debian/patchload.c:64: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 envelope_offset[6];
data/playmidi-2.4debian/patchload.c:91: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[256], name[256];
data/playmidi-2.4debian/patchload.c:127:18:  [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 ((patfd = open(name, O_RDONLY, 0)) == -1)
data/playmidi-2.4debian/patchload.c:143: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((char *) &header, buf, sizeof(header));
data/playmidi-2.4debian/patchload.c:168:2:  [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((char *) &sample, buf, sizeof(sample));
data/playmidi-2.4debian/patchload.c:180:2:  [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(sample.envelope_rate, &buf[37], 6);
data/playmidi-2.4debian/patchload.c:181:2:  [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(sample.envelope_offset, &buf[43], 6);
data/playmidi-2.4debian/patchload.c:217:2:  [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(patch->env_rate, sample.envelope_rate, 6);
data/playmidi-2.4debian/patchload.c:338: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[60];
data/playmidi-2.4debian/patchload.c:347: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).
	sbfd = open(file = O3MELODIC, O_RDONLY, 0);
data/playmidi-2.4debian/patchload.c:350: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).
	sbfd = open(file = SBMELODIC, O_RDONLY, 0);
data/playmidi-2.4debian/patchload.c:380: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).
	sbfd = open(file = O3DRUMS, O_RDONLY, 0);
data/playmidi-2.4debian/patchload.c:382: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).
	sbfd = open(file = SBDRUMS, O_RDONLY, 0);
data/playmidi-2.4debian/playmidi.c:67: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 *gmvoice[256];
data/playmidi-2.4debian/playmidi.c:109:18:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
  switch (cpid = vfork ())
data/playmidi-2.4debian/playmidi.c:289:10:  [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).
	    j = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:304:22:  [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).
	    FORCE_EXT_DEV = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:319:20:  [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).
	    find_header = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:353:13:  [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).
		newprog = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:363:11:  [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).
		    j = atoi(extra);
data/playmidi-2.4debian/playmidi.c:375:17:  [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).
		    newprog = atoi(extra);
data/playmidi-2.4debian/playmidi.c:422:15:  [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).
	    reverb = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:429:15:  [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).
	    chorus = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:436:16:  [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).
	    p_remap = atoi(optarg);
data/playmidi-2.4debian/playmidi.c:448:7:  [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).
		j = atoi(extra);
data/playmidi-2.4debian/playmidi.c:460:13:  [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).
		newprog = atoi(extra);
data/playmidi-2.4debian/playmidi.c:519:18:  [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 ((seqfd = open(seqdev, O_WRONLY, 0)) < 0) {
data/playmidi-2.4debian/playmidi.c:539: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).
	      if ((mfd = fopen(extra, "r")) == NULL)
data/playmidi-2.4debian/playmidi.c:548: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 temp[1024];
data/playmidi-2.4debian/playmidi.c:568:18:  [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).
		info.st_size = atoi(tok); /* original size */
data/playmidi-2.4debian/playmidi.c:573:24:  [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 if ((mfd = fopen(filename, "r")) == NULL)
data/playmidi-2.4debian/seq2mid.c:22:10:  [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 midifluff[FLUFFSIZE] =
data/playmidi-2.4debian/seq2mid.c:38:10:  [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 endfluff[ENDFLUFFSIZE] =
data/playmidi-2.4debian/seq2mid.c:59: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 delta[4], inputbuf[5], mid[8], cmd = 0;
data/playmidi-2.4debian/seq2mid.c:68:19:  [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 ((infile = open(argv[1], O_RDONLY, 0)) < 0) {
data/playmidi-2.4debian/seq2mid.c:72:20:  [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 ((outfile = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0666))
data/playmidi-2.4debian/toy.c:44:10:  [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 inputbuf[SEQUENCERBLOCKSIZE];
data/playmidi-2.4debian/toy.c:45:10:  [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 outputbuf[SEQUENCERBLOCKSIZE];
data/playmidi-2.4debian/toy.c:96: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 mid[8], imid[8], cmd = 0, icmd = 0;
data/playmidi-2.4debian/toy.c:104:16:  [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).
	    channel = atoi(optarg);
data/playmidi-2.4debian/toy.c:107:16:  [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).
	    program = atoi(optarg);
data/playmidi-2.4debian/toy.c:113:18:  [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).
	    transpose = atoi(optarg);
data/playmidi-2.4debian/toy.c:126:18:  [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 ((seqfd = open(SEQUENCER_DEV, O_RDWR, 0)) < 0) {
data/playmidi-2.4debian/toy.c:130:19:  [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 ((infile = open(argv[optind], O_RDONLY, 0)) < 0) {
data/playmidi-2.4debian/toy.c:134:20:  [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 ((outfile = open(argv[optind + 1], O_WRONLY | O_CREAT | O_TRUNC, 0666))
data/playmidi-2.4debian/beat.c:29:2:  [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(j);
data/playmidi-2.4debian/io_gtk.c:225:28:  [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).
#define TEXTBUF		(&textbuf[strlen(textbuf)])
data/playmidi-2.4debian/io_gtk.c:236:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(textbuf, data, length > TEXTSIZE - 4 ? TEXTSIZE - 4 : length);
data/playmidi-2.4debian/io_gtk.c:237:2:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
	sprintf(TEXTBUF, "\n");
data/playmidi-2.4debian/io_gtk.c:266:6:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
	    sprintf(TEXTBUF, "\n");
data/playmidi-2.4debian/io_ncurses.c:164:6:  [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(100000);
data/playmidi-2.4debian/io_ncurses.c:201:6:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	    strncpy(textbuf, (const char *)data, length < COLS - karaoke ? length :
data/playmidi-2.4debian/io_ncurses.c:206:14:  [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).
		karaoke += strlen(textbuf);
data/playmidi-2.4debian/io_ncurses.c:321:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(textbuf, (tmp == NULL ? filename : tmp + 1), COLS - 53);
data/playmidi-2.4debian/io_ncurses.c:322: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(textbuf) > COLS - 53)
data/playmidi-2.4debian/io_svgalib.c:99:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(mytty, &ch, 1))
data/playmidi-2.4debian/io_svgalib.c:147:6:  [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(100000);
data/playmidi-2.4debian/io_svgalib.c:182:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(textbuf, data, length < COLS - 66 ? length : COLS - 66);
data/playmidi-2.4debian/io_svgalib.c:215:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(textbuf, gmvoice[NOTE], 3);
data/playmidi-2.4debian/io_svgalib.c:217:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(textbuf, drum3ch[SET(NOTE)], 3);
data/playmidi-2.4debian/io_svgalib.c:257:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(textbuf, (tmp == NULL ? filename : tmp + 1), 14);
data/playmidi-2.4debian/io_xaw.c:253:6:  [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(750);
data/playmidi-2.4debian/io_xaw.c:274: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).
    textblk.length = strlen(s);
data/playmidi-2.4debian/io_xaw.c:281:28:  [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).
#define TEXTBUF		(&textbuf[strlen(textbuf)])
data/playmidi-2.4debian/io_xaw.c:294:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(textbuf, (const char *)data, length > TEXTSIZE - 4 ? TEXTSIZE - 4 : length);
data/playmidi-2.4debian/io_xaw.c:296:2:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
	sprintf(TEXTBUF, "\n");
data/playmidi-2.4debian/io_xaw.c:326:6:  [1] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source is a constant character.
	    sprintf(TEXTBUF, "\n");
data/playmidi-2.4debian/patchload.c:139:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (read(patfd, buf, 0xef) != 0xef) {
data/playmidi-2.4debian/patchload.c:164:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(patfd, &buf, sizeof(sample)) != sizeof(sample)) {
data/playmidi-2.4debian/patchload.c:247:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(patfd, patch->data, sample.len) != sample.len) {
data/playmidi-2.4debian/patchload.c:357:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(sbfd, buf, voice_size) != voice_size)
data/playmidi-2.4debian/patchload.c:385:6:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (read(sbfd, buf, voice_size) != voice_size)
data/playmidi-2.4debian/playmidi.c:219: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).
    k = strlen(s);
data/playmidi-2.4debian/playmidi.c:338:16:  [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).
		    for (k = strlen(extra); k < 8; k++)
data/playmidi-2.4debian/playmidi.c:533: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 fl = strlen (filename);
data/playmidi-2.4debian/seq2mid.c:79:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    while (read(infile, inputbuf, 4) == 4) {
data/playmidi-2.4debian/toy.c:85:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    return read(f, buf, 4);

ANALYSIS SUMMARY:

Hits = 139
Lines analyzed = 4446 in approximately 0.16 seconds (27662 lines/second)
Physical Source Lines of Code (SLOC) = 3691
Hits@level = [0]  69 [1]  32 [2]  98 [3]   3 [4]   6 [5]   0
Hits@level+ = [0+] 208 [1+] 139 [2+] 107 [3+]   9 [4+]   6 [5+]   0
Hits/KSLOC@level+ = [0+] 56.3533 [1+] 37.6592 [2+] 28.9894 [3+] 2.43836 [4+] 1.62558 [5+]   0
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.