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/pmidi-1.7.1/src/elements.h Examining data/pmidi-1.7.1/src/seqmidi.c Examining data/pmidi-1.7.1/src/glib.c Examining data/pmidi-1.7.1/src/seqlib.h Examining data/pmidi-1.7.1/src/except.c Examining data/pmidi-1.7.1/src/glib.h Examining data/pmidi-1.7.1/src/intl.h Examining data/pmidi-1.7.1/src/seqpriv.h Examining data/pmidi-1.7.1/src/except.h Examining data/pmidi-1.7.1/src/mdutil.c Examining data/pmidi-1.7.1/src/midi.h Examining data/pmidi-1.7.1/src/seqlib.c Examining data/pmidi-1.7.1/src/elements.c Examining data/pmidi-1.7.1/src/pmidi.c Examining data/pmidi-1.7.1/src/md.h Examining data/pmidi-1.7.1/src/midiread.c FINAL RESULTS: data/pmidi-1.7.1/src/except.c:49:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, message, ap); data/pmidi-1.7.1/src/glib.h:251:26: [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. __attribute__((format (printf, format_idx, arg_idx))) data/pmidi-1.7.1/src/glib.h:253:26: [4] (buffer) scanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. __attribute__((format (scanf, format_idx, arg_idx))) data/pmidi-1.7.1/src/glib.h:1293:19: [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 g_warning printf data/pmidi-1.7.1/src/glib.h:1381:8: [3] (buffer) g_get_home_dir: This function is synonymous with 'getenv("HOME")';it returns untrustable input if the environment can beset by an attacker. It 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. gchar* g_get_home_dir (void); data/pmidi-1.7.1/src/glib.h:1382:8: [3] (buffer) g_get_tmp_dir: This function is synonymous with 'getenv("TMP")';it returns untrustable input if the environment can beset by an attacker. It 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. gchar* g_get_tmp_dir (void); data/pmidi-1.7.1/src/pmidi.c:119:7: [3] (buffer) getopt_long: 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. c = getopt_long(argc, argv, opts, long_opts, NULL); data/pmidi-1.7.1/src/pmidi.c:144:14: [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. portdesc = getenv("ALSA_OUTPUT_PORTS"); data/pmidi-1.7.1/src/pmidi.c:147:15: [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. portdesc = getenv("ALSA_OUT_PORT"); data/pmidi-1.7.1/src/glib.c:192: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 (array->data + array->elt_size * array->len, data, array->elt_size * len); data/pmidi-1.7.1/src/midiread.c:116:7: [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). fp = fopen(name, "rb"); data/pmidi-1.7.1/src/pmidi.c:97: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 opts[NELEM(long_opts) * 2 + 1]; data/pmidi-1.7.1/src/pmidi.c:128:12: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). delay = atoi(optarg); data/pmidi-1.7.1/src/pmidi.c:208: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). a[count++] = atoi(cp); data/pmidi-1.7.1/src/seqmidi.c:267: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(ndata+1, data, length); data/pmidi-1.7.1/src/elements.c:344:17: [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). new->length = strlen(text); data/pmidi-1.7.1/src/midiread.c:160:10: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (void) getc(msp->fp); data/pmidi-1.7.1/src/midiread.c:449:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(msp->fp); data/pmidi-1.7.1/src/midiread.c:506:7: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(msp->fp); data/pmidi-1.7.1/src/pmidi.c:200:31: [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). addr = g_new(snd_seq_addr_t, strlen(portdesc)); ANALYSIS SUMMARY: Hits = 20 Lines analyzed = 4781 in approximately 0.11 seconds (42203 lines/second) Physical Source Lines of Code (SLOC) = 3011 Hits@level = [0] 12 [1] 5 [2] 6 [3] 5 [4] 4 [5] 0 Hits@level+ = [0+] 32 [1+] 20 [2+] 15 [3+] 9 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 10.6277 [1+] 6.64231 [2+] 4.98173 [3+] 2.98904 [4+] 1.32846 [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.