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/elektroid-1.2/src/audio.c Examining data/elektroid-1.2/src/audio.h Examining data/elektroid-1.2/src/browser.c Examining data/elektroid-1.2/src/browser.h Examining data/elektroid-1.2/src/connector.c Examining data/elektroid-1.2/src/connector.h Examining data/elektroid-1.2/src/elektroid-cli.c Examining data/elektroid-1.2/src/elektroid.c Examining data/elektroid-1.2/src/sample.c Examining data/elektroid-1.2/src/sample.h Examining data/elektroid-1.2/src/utils.c Examining data/elektroid-1.2/src/utils.h FINAL RESULTS: data/elektroid-1.2/src/browser.c:167:7: [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 (browser->dir, new_path); data/elektroid-1.2/src/browser.c:194:7: [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 (browser->dir, name); data/elektroid-1.2/src/connector.c:396:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Output port is NULL\n"); data/elektroid-1.2/src/connector.c:402:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while sending message. %s.\n", data/elektroid-1.2/src/connector.c:493:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Input port is NULL\n"); data/elektroid-1.2/src/connector.c:516:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while receiving message. %s.\n", data/elektroid-1.2/src/connector.c:979:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while closing MIDI port: %s\n", data/elektroid-1.2/src/connector.c:990:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while closing MIDI port: %s\n", data/elektroid-1.2/src/connector.c:1026:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening MIDI port: %s\n", data/elektroid-1.2/src/connector.c:1034:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while setting blocking mode\n"); data/elektroid-1.2/src/connector.c:1039:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while setting blocking mode\n"); data/elektroid-1.2/src/connector.c:1046:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while stopping device\n"); data/elektroid-1.2/src/connector.c:1143:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, data/elektroid-1.2/src/connector.c:1177:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": cannot open control for card %d: %s\n", data/elektroid-1.2/src/connector.c:1193:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": cannot determine device number: %s\n", data/elektroid-1.2/src/connector.c:1213:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": cannot determine card number: %s\n", data/elektroid-1.2/src/elektroid.c:986:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening remote %s dir\n", data/elektroid-1.2/src/elektroid.c:1029:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening local %s dir\n", data/elektroid-1.2/src/elektroid.c:1101:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, data/elektroid-1.2/src/elektroid.c:1229:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening remote %s dir\n", data/elektroid-1.2/src/elektroid.c:1272:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening local %s dir\n", data/elektroid-1.2/src/elektroid.c:1542:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while uploading\n"); data/elektroid-1.2/src/elektroid.c:1613:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening local %s dir\n", data/elektroid-1.2/src/elektroid.c:1621:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while creating remote %s dir\n", data/elektroid-1.2/src/elektroid.c:1745:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while downloading\n"); data/elektroid-1.2/src/elektroid.c:1789:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while opening remote %s dir\n", data/elektroid-1.2/src/elektroid.c:1797:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while creating local %s dir\n", data/elektroid-1.2/src/elektroid.c:1920:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Error while connecting\n"); data/elektroid-1.2/src/elektroid.c:1967:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Path too long\n"); data/elektroid-1.2/src/elektroid.c:1974:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Path too long\n"); data/elektroid-1.2/src/elektroid.c:2225:3: [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 (local_browser.dir, local_dir); data/elektroid-1.2/src/sample.c:225:7: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": src_process() failed: %s\n", data/elektroid-1.2/src/utils.c:204:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf (stderr, __FILE__ ": Unable to open dir %s\n", local_dir); data/elektroid-1.2/src/utils.c:213:7: [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 (startup_path, exp_result.we_wordv[0]); data/elektroid-1.2/src/utils.h:28:59: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define debug_print(level, ...) if (level <= debug_level) fprintf(stderr, __VA_ARGS__) data/elektroid-1.2/src/elektroid-cli.c:421:15: [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 ((c = getopt (argc, argv, "v")) != -1) data/elektroid-1.2/src/elektroid.c:2267:15: [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 ((c = getopt (argc, argv, "l:v")) != -1) data/elektroid-1.2/src/utils.c:200:4: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. realpath (local_dir, startup_path); data/elektroid-1.2/src/connector.c:273:3: [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->data[5], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:313:3: [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->data[5], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:318: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 (&msg->data[9], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:320: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 (&msg->data[21], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:322: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 (&msg->data[33], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:327: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 (&msg->data[9], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:329: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 (&msg->data[13], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:343:3: [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->data[5], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:345:3: [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->data[9], &aux32, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:358:3: [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->data[5], &aux, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:360:3: [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->data[9], &aux, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:362:3: [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->data[13], &aux, sizeof (uint32_t)); data/elektroid-1.2/src/connector.c:455:3: [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->data, &aux, sizeof (uint16_t)); data/elektroid-1.2/src/connector.c:1007: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 (name, "hw:%d", card); data/elektroid-1.2/src/connector.c:1174: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 (name, "hw:%d", card); data/elektroid-1.2/src/elektroid-cli.c:71: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). gint card = atoi (device_path); data/elektroid-1.2/src/elektroid-cli.c:176:14: [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). card_src = atoi (device_path_src); data/elektroid-1.2/src/elektroid-cli.c:177:14: [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). card_dst = atoi (device_path_dst); data/elektroid-1.2/src/elektroid.c:422:14: [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, "w"); data/elektroid-1.2/src/elektroid.c:477:14: [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/elektroid-1.2/src/elektroid.c:950: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 human_size[SIZE_LABEL_LEN]; data/elektroid-1.2/src/elektroid.c:1961: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 hostname[LABEL_MAX]; data/elektroid-1.2/src/browser.c:192:4: [1] (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). Risk is low because the source is a constant character. strcat (browser->dir, "/"); data/elektroid-1.2/src/connector.c:226:46: [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). g_byte_array_append (msg, (guchar *) path, strlen (path)); data/elektroid-1.2/src/connector.c:663:48: [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). g_byte_array_append (tx_msg, (guchar *) old, strlen (old)); data/elektroid-1.2/src/connector.c:665:48: [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). g_byte_array_append (tx_msg, (guchar *) new, strlen (new)); data/elektroid-1.2/src/elektroid-cli.c:37: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). gint len = strlen (device_path); data/elektroid-1.2/src/elektroid.c:1184:7: [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 (gtk_entry_get_text (name_dialog_entry)) > 0) data/elektroid-1.2/src/elektroid.c:1925:4: [1] (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 character. strcpy (remote_browser.dir, "/"); data/elektroid-1.2/src/utils.c:120: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). gint namelen = strlen (name); data/elektroid-1.2/src/utils.c:135: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). int namelen = strlen (name) - 1; ANALYSIS SUMMARY: Hits = 69 Lines analyzed = 5329 in approximately 0.12 seconds (45200 lines/second) Physical Source Lines of Code (SLOC) = 4346 Hits@level = [0] 37 [1] 9 [2] 22 [3] 3 [4] 35 [5] 0 Hits@level+ = [0+] 106 [1+] 69 [2+] 60 [3+] 38 [4+] 35 [5+] 0 Hits/KSLOC@level+ = [0+] 24.3902 [1+] 15.8767 [2+] 13.8058 [3+] 8.74367 [4+] 8.05338 [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.