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/a2jmidid-9/a2jmidi_bridge.c Examining data/a2jmidid-9/a2jmidid.c Examining data/a2jmidid-9/a2jmidid.h Examining data/a2jmidid-9/conf.c Examining data/a2jmidid-9/conf.h Examining data/a2jmidid-9/dbus.c Examining data/a2jmidid-9/dbus.h Examining data/a2jmidid-9/dbus_iface_control.c Examining data/a2jmidid-9/dbus_iface_control.h Examining data/a2jmidid-9/dbus_iface_introspectable.c Examining data/a2jmidid-9/dbus_internal.h Examining data/a2jmidid-9/j2amidi_bridge.c Examining data/a2jmidid-9/jack.c Examining data/a2jmidid-9/jack.h Examining data/a2jmidid-9/list.c Examining data/a2jmidid-9/list.h Examining data/a2jmidid-9/log.c Examining data/a2jmidid-9/log.h Examining data/a2jmidid-9/paths.c Examining data/a2jmidid-9/paths.h Examining data/a2jmidid-9/port.c Examining data/a2jmidid-9/port.h Examining data/a2jmidid-9/port_hash.c Examining data/a2jmidid-9/port_hash.h Examining data/a2jmidid-9/port_thread.c Examining data/a2jmidid-9/port_thread.h Examining data/a2jmidid-9/sigsegv.c Examining data/a2jmidid-9/sigsegv.h Examining data/a2jmidid-9/structs.h FINAL RESULTS: data/a2jmidid-9/dbus.c:44:3: [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. vsnprintf(buffer, sizeof(buffer), format, ap); data/a2jmidid-9/dbus_iface_introspectable.c:66:19: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. g_buffer_ptr += vsprintf(g_buffer_ptr, format, ap); data/a2jmidid-9/log.c:136: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(stream, format, ap); data/a2jmidid-9/a2jmidid.c:472:17: [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. while ((c = getopt_long(argc, argv, "j:eu", long_opts, &option_index)) != -1) data/a2jmidid-9/paths.c:156:13: [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. home_dir = getenv("HOME"); data/a2jmidid-9/a2jmidi_bridge.c:58:21: [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 buffer[16]; data/a2jmidid-9/a2jmidi_bridge.c:80:21: [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 buffer[16]; data/a2jmidid-9/a2jmidi_bridge.c:97:21: [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(p, buffer + 1, count); data/a2jmidid-9/a2jmidid.c:439: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 timestamp_str[26]; data/a2jmidid-9/conf.c:100: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 timestamp_str[26]; data/a2jmidid-9/conf.c:108:8: [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(g_a2j_conf_path, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); data/a2jmidid-9/conf.c:191: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 option[MAX_OPTION_LENGTH+1]; data/a2jmidid-9/conf.c:275: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(context_ptr->option + context_ptr->option_used, s, len); data/a2jmidid-9/conf.c:385:8: [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(g_a2j_conf_path, O_RDONLY); data/a2jmidid-9/dbus.c:40: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 buffer[300]; data/a2jmidid-9/dbus_iface_introspectable.c:28: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. static char g_xml_data[102400]; data/a2jmidid-9/j2amidi_bridge.c:229: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. static char event_buffer[1024]; data/a2jmidid-9/jack.c:115:7: [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( buf, ev_buf + sizeof(ev), ev.size ); data/a2jmidid-9/jack.c:200: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( vec[0].buf, ev_charp, limit ); data/a2jmidid-9/jack.c:207: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( vec[1].buf, ev_charp, to_write ); data/a2jmidid-9/jack.c:216: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( vec[0].buf, ev_charp, limit ); data/a2jmidid-9/jack.c:220: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( vec[1].buf, ev_charp, to_write ); data/a2jmidid-9/jack.c:261:7: [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( dev->midistring, dev->jack_event.buffer, dev->jack_event.size ); data/a2jmidid-9/jack.c:287: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(dev->midistring, dev->jack_event.buffer, dev->jack_event.size); data/a2jmidid-9/log.c:57:21: [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). g_logfile = fopen(g_a2j_log_path, "a"); data/a2jmidid-9/log.c:106: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 timestamp_str[26]; data/a2jmidid-9/paths.c:57: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(str, str1, str1_len); data/a2jmidid-9/paths.c:58: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(str + str1_len, str2, str2_len); data/a2jmidid-9/sigsegv.c:53:18: [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 *si_codes[3] = {"", "SEGV_MAPERR", "SEGV_ACCERR"}; data/a2jmidid-9/structs.h:53: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[0]; data/a2jmidid-9/structs.h:118: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 midistring[MAX_JACKMIDI_EV_SIZE]; data/a2jmidid-9/a2jmidid.c:558: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(MAIN_LOOP_SLEEP_INTERVAL * 1000); data/a2jmidid-9/conf.c:44: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). len = strlen(string); data/a2jmidid-9/conf.c:410:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bytes_read = read(fd, buffer, st.st_size); data/a2jmidid-9/paths.c:48:13: [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). str1_len = strlen(str1); data/a2jmidid-9/paths.c:49:13: [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). str2_len = strlen(str2); ANALYSIS SUMMARY: Hits = 36 Lines analyzed = 6075 in approximately 0.13 seconds (45751 lines/second) Physical Source Lines of Code (SLOC) = 4007 Hits@level = [0] 24 [1] 5 [2] 26 [3] 2 [4] 3 [5] 0 Hits@level+ = [0+] 60 [1+] 36 [2+] 31 [3+] 5 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 14.9738 [1+] 8.98428 [2+] 7.73646 [3+] 1.24782 [4+] 0.74869 [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.