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/aj-snapshot-0.9.9/src/aj-jack.c Examining data/aj-snapshot-0.9.9/src/aj-jack.h Examining data/aj-snapshot-0.9.9/src/aj-alsa.c Examining data/aj-snapshot-0.9.9/src/aj-remove.c Examining data/aj-snapshot-0.9.9/src/aj-snapshot.h Examining data/aj-snapshot-0.9.9/src/aj-remove.h Examining data/aj-snapshot-0.9.9/src/aj-file.c Examining data/aj-snapshot-0.9.9/src/aj-alsa.h Examining data/aj-snapshot-0.9.9/src/aj-file.h Examining data/aj-snapshot-0.9.9/src/aj-snapshot.c FINAL RESULTS: data/aj-snapshot-0.9.9/src/aj-jack.c:101: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(tmp_str, dest_port); // dest_port is 'const char*' data/aj-snapshot-0.9.9/src/aj-jack.c:195:13: [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(tmp_str, connected_port); // otherwise we change the names of ports in jack !! data/aj-snapshot-0.9.9/src/aj-jack.c:231: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(tmp_str, full_name); // otherwise we change the names of ports in jack !! data/aj-snapshot-0.9.9/src/aj-jack.c:240:17: [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(client_name_prev, client_name); data/aj-snapshot-0.9.9/src/aj-jack.c:250:17: [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(client_name_prev, client_name); data/aj-snapshot-0.9.9/src/aj-snapshot.c:135:13: [4] (shell) system: 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. system |= ALSA; data/aj-snapshot-0.9.9/src/aj-snapshot.c:138:13: [4] (shell) system: 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. system |= JACK; data/aj-snapshot-0.9.9/src/aj-snapshot.c:237:10: [4] (shell) system: 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. if ((system & ALSA) == ALSA) { data/aj-snapshot-0.9.9/src/aj-snapshot.c:260:10: [4] (shell) system: 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. if ((system & JACK) == JACK) { data/aj-snapshot-0.9.9/src/aj-snapshot.c:381:18: [4] (shell) system: 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. if ((system & JACK) == JACK) { data/aj-snapshot-0.9.9/src/aj-snapshot.h:41:34: [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 VERBOSE(str) if(verbose) fprintf(stdout, str) data/aj-snapshot-0.9.9/src/aj-snapshot.c:130: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, "ajrdxfi:p:qh", long_option, NULL)) != -1) { data/aj-snapshot-0.9.9/src/aj-alsa.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 port_id[4]; data/aj-snapshot-0.9.9/src/aj-alsa.c:75: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 port_id[3]; data/aj-snapshot-0.9.9/src/aj-alsa.c:155:24: [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). dest_port_id = atoi(dest_id); data/aj-snapshot-0.9.9/src/aj-alsa.c:211:19: [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). port_id = atoi(id); data/aj-snapshot-0.9.9/src/aj-file.c:52: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). if( (file = fopen(filename, "r")) == NULL ){ data/aj-snapshot-0.9.9/src/aj-file.c:67: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). if( (file = fopen(filename, "r")) ){ data/aj-snapshot-0.9.9/src/aj-file.c:78: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). if( (file = fopen(filename, "w")) == NULL ){ data/aj-snapshot-0.9.9/src/aj-jack.c:90: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 src_port[s]; data/aj-snapshot-0.9.9/src/aj-jack.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 tmp_str[jack_port_name_size()]; data/aj-snapshot-0.9.9/src/aj-jack.c:191: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 tmp_str[jack_port_name_size()]; data/aj-snapshot-0.9.9/src/aj-jack.c:216: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 tmp_str[jack_port_name_size()]; data/aj-snapshot-0.9.9/src/aj-jack.c:217: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 client_name_prev[jack_port_name_size()]; data/aj-snapshot-0.9.9/src/aj-snapshot.c:79: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 *ignored_clients[IGNORED_CLIENTS_MAX]; // array to store names of ignored clients data/aj-snapshot-0.9.9/src/aj-snapshot.c:161:35: [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). polling_interval_ms = atoi(optarg); data/aj-snapshot-0.9.9/src/aj-file.c:70:18: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). char answer = getc(stdin); data/aj-snapshot-0.9.9/src/aj-jack.c:89: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). unsigned int s = strlen(client_name) + strlen(port_name) + 2; data/aj-snapshot-0.9.9/src/aj-jack.c:89:44: [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). unsigned int s = strlen(client_name) + strlen(port_name) + 2; data/aj-snapshot-0.9.9/src/aj-snapshot.c:461: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(polling_interval_ms * 1000); ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 1341 in approximately 0.07 seconds (17989 lines/second) Physical Source Lines of Code (SLOC) = 937 Hits@level = [0] 64 [1] 4 [2] 14 [3] 1 [4] 11 [5] 0 Hits@level+ = [0+] 94 [1+] 30 [2+] 26 [3+] 12 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 100.32 [1+] 32.0171 [2+] 27.7481 [3+] 12.8068 [4+] 11.7396 [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.