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/mpg321-0.3.2/remote.c Examining data/mpg321-0.3.2/fft.c Examining data/mpg321-0.3.2/ao.c Examining data/mpg321-0.3.2/auth.c Examining data/mpg321-0.3.2/mpg321.h Examining data/mpg321-0.3.2/network.c Examining data/mpg321-0.3.2/scrobbler.c Examining data/mpg321-0.3.2/options.c Examining data/mpg321-0.3.2/volume.c Examining data/mpg321-0.3.2/fbuffer.c Examining data/mpg321-0.3.2/playlist.c Examining data/mpg321-0.3.2/mpg321.c Examining data/mpg321-0.3.2/mad.c FINAL RESULTS: data/mpg321-0.3.2/ao.c:457: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(card,options.device); data/mpg321-0.3.2/ao.c:752: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(card,options.device); data/mpg321-0.3.2/auth.c:88:2: [4] (buffer) sscanf: 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. sscanf(t,":%s",(char *)&pass_arg); data/mpg321-0.3.2/auth.c:95:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(p,"%s:%s",user_arg,pass_arg); data/mpg321-0.3.2/auth.c:102:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(p,"%s:%s",user_arg_var,pass_arg_var); data/mpg321-0.3.2/mad.c:384:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ao_time, "Frame# %5lu [%5lu], Time: %s [%s], \r", current_frame, data/mpg321-0.3.2/mpg321.c:450:17: [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(emptystring); data/mpg321-0.3.2/mpg321.c:468:17: [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, emptystring); data/mpg321-0.3.2/mpg321.c:575:9: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if(access(argv[0],X_OK) == 0) data/mpg321-0.3.2/network.c:518:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(http_length,"%s",http_response+16); data/mpg321-0.3.2/network.c:662:4: [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(pl[j],equ); data/mpg321-0.3.2/playlist.c:213:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(new_path, "%s/%s", path, entry->d_name); data/mpg321-0.3.2/playlist.c:299: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(pl->files[pl->numfiles], directory); data/mpg321-0.3.2/playlist.c:301:13: [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(pl->files[pl->numfiles], playlist_buf); data/mpg321-0.3.2/remote.c:82:5: [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 (input, remote_input_buf); data/mpg321-0.3.2/remote.c:84:5: [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 (new_remote_input_buf, remote_input_buf + linelen + 1); data/mpg321-0.3.2/remote.c:86:5: [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 (remote_input_buf, new_remote_input_buf); data/mpg321-0.3.2/scrobbler.c:101:13: [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(args[0], args); data/mpg321-0.3.2/ao.c:123:17: [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. if (getenv("ESD_NO_SPAWN")) unset = 0; /* only unset it later data/mpg321-0.3.2/ao.c:187:17: [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. if (getenv("ESD_NO_SPAWN")) unset = 0; /* only unset it later data/mpg321-0.3.2/auth.c:98:18: [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. user_arg_var = getenv(user_arg); data/mpg321-0.3.2/auth.c:99:18: [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. pass_arg_var = getenv(pass_arg); data/mpg321-0.3.2/mad.c:800:15: [3] (random) random: 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. mad_fixed_t random; data/mpg321-0.3.2/mad.c:822:29: [3] (random) random: 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. mad_fixed_t output, mask, random; data/mpg321-0.3.2/mad.c:842:26: [3] (random) random: 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. random = prng(dither->random); data/mpg321-0.3.2/mad.c:843:14: [3] (random) random: 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. output += (random & mask) - (dither->random & mask); data/mpg321-0.3.2/mad.c:843:40: [3] (random) random: 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. output += (random & mask) - (dither->random & mask); data/mpg321-0.3.2/mad.c:845:20: [3] (random) random: 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. dither->random = random; data/mpg321-0.3.2/options.c:136: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, data/mpg321-0.3.2/playlist.c:53: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(time(NULL)); data/mpg321-0.3.2/auth.c:50: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 authstring[80]; data/mpg321-0.3.2/auth.c:84: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 user_arg[16],pass_arg[16],*t,*p=NULL; data/mpg321-0.3.2/mad.c:218: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 long_currenttime_str[14]; /* this *will* fill if you're using 100000+ minute mp3s */ data/mpg321-0.3.2/mad.c:219: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 long_remaintime_str[14]; data/mpg321-0.3.2/mad.c:403:8: [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(ao_time,"@F %ld %ld %.2f %.2f\n", current_frame, playbuf->num_frames - current_frame, data/mpg321-0.3.2/mad.c:425:12: [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 toc[100]; data/mpg321-0.3.2/mad.c:612:12: [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 file[PATH_MAX] = ""; data/mpg321-0.3.2/mad.c:712: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 buffer[3]; data/mpg321-0.3.2/mad.c:720: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). f = open(file, O_RDONLY); data/mpg321-0.3.2/mad.c:904: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. static char buff_samples[1024]; data/mpg321-0.3.2/mad.c:918: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(&buff_samples[buff_sample_count], data, 1024 - buff_sample_count); data/mpg321-0.3.2/mad.c:933: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(buff_samples, &data[samples], size - samples); data/mpg321-0.3.2/mad.c:945: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 stream[1152*4]; /* 1152 because that's what mad has as a max; *4 because data/mpg321-0.3.2/mad.c:964:6: [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(&((Output_Queue+mad_decoder_position)->header),header,sizeof(struct mad_header)); data/mpg321-0.3.2/mpg321.c:79: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 temp[1024]; data/mpg321-0.3.2/mpg321.c:82: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 title[BUFSIZ]; data/mpg321-0.3.2/mpg321.c:124: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(&old_terminal_settings, &terminal_settings, sizeof(struct termios)); data/mpg321-0.3.2/mpg321.c:432: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 emptystring[31]; data/mpg321-0.3.2/mpg321.c:433: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 *names[6]; data/mpg321-0.3.2/mpg321.c:505: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 *currentfile, old_dir[PATH_MAX]; data/mpg321-0.3.2/mpg321.c:752:11: [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(&old_terminal_settings, &terminal_settings, sizeof(struct termios)); data/mpg321-0.3.2/mpg321.c:803:7: [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 emptystring[31], emptyyear[5] = " "; data/mpg321-0.3.2/mpg321.c:904:22: [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((fd = open(currentfile, O_RDONLY)) == -1) data/mpg321-0.3.2/mpg321.c:1068: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(&old_terminal_settings, &terminal_settings, sizeof(struct termios)); data/mpg321-0.3.2/mpg321.c:1119:13: [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 time_formatted[11]; data/mpg321-0.3.2/mpg321.c:1220: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 printable [1024]; data/mpg321-0.3.2/mpg321.c:1296: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 ((ctty = fopen((char *)ctty_path(), "r+")) == NULL) { data/mpg321-0.3.2/mpg321.c:1441: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. static char buffer[BUFSIZ]; data/mpg321-0.3.2/mpg321.c:1442: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 temp[20]; data/mpg321-0.3.2/mpg321.c:1474: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((char *)title,"xterm"); data/mpg321-0.3.2/mpg321.h:58: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 remote_file[PATH_MAX]; data/mpg321-0.3.2/mpg321.h:92: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 filename[PATH_MAX]; data/mpg321-0.3.2/mpg321.h:117: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 remote_input_buf[PATH_MAX + 5]; data/mpg321-0.3.2/mpg321.h:123: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 *scrobbler_args[6]; data/mpg321-0.3.2/mpg321.h:267:11: [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 data[4*1152]; data/mpg321-0.3.2/mpg321.h:270: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 time[80]; data/mpg321-0.3.2/network.c:57: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 authstring[80]; data/mpg321-0.3.2/network.c:166: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 ipstring[MAX_HOSTNAME]; data/mpg321-0.3.2/network.c:167: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 portstring[MAX_HOSTNAME]; data/mpg321-0.3.2/network.c:233: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 ipstring[MAX_HOSTNAME]; data/mpg321-0.3.2/network.c:234: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 portstring[MAX_HOSTNAME]; data/mpg321-0.3.2/network.c:348: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). port = atoi(strchr(host, ':') + 1); data/mpg321-0.3.2/network.c:414: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 http_request[PATH_MAX]; data/mpg321-0.3.2/network.c:415: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 http_response[PATH_MAX]; data/mpg321-0.3.2/network.c:416: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 path[PATH_MAX]; data/mpg321-0.3.2/network.c:420: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 phost[16]; data/mpg321-0.3.2/network.c:439: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). port = atoi(strchr(host, ':') + 1); data/mpg321-0.3.2/network.c:447: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). pport = atoi(strchr(proxy_server,':')+1); data/mpg321-0.3.2/network.c:517:15: [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 http_length[20]; data/mpg321-0.3.2/network.c:519:27: [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). http_file_length = atoi(http_length); data/mpg321-0.3.2/network.c:599: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 http_response[PATH_MAX]; data/mpg321-0.3.2/network.c:685: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 answer[1024]; data/mpg321-0.3.2/network.c:702: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). return (atoi(answer)); data/mpg321-0.3.2/network.c:713: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 ftp_request[PATH_MAX]; data/mpg321-0.3.2/network.c:738: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). port = atoi(strchr(host, ':') + 1); data/mpg321-0.3.2/options.c:164:37: [2] (integer) atol: 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). options.maxframes = atol(optarg); data/mpg321-0.3.2/options.c:199:32: [2] (integer) atol: 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). options.seek = atol(optarg); data/mpg321-0.3.2/options.c:254: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). buffer_size = atoi(optarg); data/mpg321-0.3.2/options.c:303:34: [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). options.volume = atoi(optarg); data/mpg321-0.3.2/options.c:307:31: [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). loop_remaining = atoi(optarg); data/mpg321-0.3.2/options.c:323:48: [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). options.skip_printing_frames = atoi(optarg); data/mpg321-0.3.2/playlist.c:263: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 playlist_buf[PATH_MAX]; data/mpg321-0.3.2/playlist.c:272:23: [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(!(plist = fopen(filename,"r"))) data/mpg321-0.3.2/remote.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 remote_input_buf[PATH_MAX + 5]; data/mpg321-0.3.2/remote.c:46: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 input[PATH_MAX + 5]; /* for filename as well as input and space */ data/mpg321-0.3.2/remote.c:47: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 new_remote_input_buf[PATH_MAX + 5]; data/mpg321-0.3.2/remote.c:130:38: [2] (integer) atol: 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). signed long toMove = atol(arg); data/mpg321-0.3.2/remote.c:144:31: [2] (integer) atol: 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). long toSeek = atol(arg); data/mpg321-0.3.2/remote.c:200:39: [2] (integer) atol: 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). mpg321_alsa_set_volume((long)atol(arg)*volume_max/100); data/mpg321-0.3.2/remote.c:204:46: [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). options.volume = mad_f_tofixed(atoi(arg)/100.0); data/mpg321-0.3.2/scrobbler.c:40: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 *scrobbler_args[6] = { data/mpg321-0.3.2/scrobbler.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 lengthbuf[20]; data/mpg321-0.3.2/scrobbler.c:82:12: [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(vfork()) { data/mpg321-0.3.2/scrobbler.c:96:6: [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(args + SARGS_POS, scrobbler_args, data/mpg321-0.3.2/ao.c:453:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(card,"alsa:\0",6); data/mpg321-0.3.2/ao.c:459:56: [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 ((c = strchr(card, ':')) == NULL || strlen(c+1) < 1) data/mpg321-0.3.2/ao.c:748:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(card,"alsa:\0",6); data/mpg321-0.3.2/ao.c:754:56: [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 ((c = strchr(card, ':')) == NULL || strlen(c+1) < 1) data/mpg321-0.3.2/auth.c:93: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). len=strlen(user_arg)+strlen(pass_arg)+2; data/mpg321-0.3.2/auth.c:93:24: [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(user_arg)+strlen(pass_arg)+2; data/mpg321-0.3.2/auth.c:100: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). len=strlen(user_arg_var)+strlen(pass_arg_var)+2; data/mpg321-0.3.2/auth.c:100: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). len=strlen(user_arg_var)+strlen(pass_arg_var)+2; data/mpg321-0.3.2/auth.c:105:42: [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). do_base64(authstring,(unsigned char *)p,strlen(p)); data/mpg321-0.3.2/mad.c:139:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). readbytes = read(playbuf->fd, playbuf->buf + bytes_to_preserve, data/mpg321-0.3.2/mad.c:617:9: [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(file, ""); data/mpg321-0.3.2/mad.c:623: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(file) == 0) data/mpg321-0.3.2/mad.c:626:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(file, buf->filename, PATH_MAX); data/mpg321-0.3.2/mad.c:752:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(f, buffer, 3) != 3) data/mpg321-0.3.2/mpg321.c:140:8: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getchar(); data/mpg321-0.3.2/mpg321.c:773:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(playbuf.filename,currentfile, PATH_MAX); data/mpg321-0.3.2/mpg321.c:1037:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(old_dir, dirn, PATH_MAX); data/mpg321-0.3.2/mpg321.c:1237:24: [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 (!latin1 || strlen(latin1) == 0) return (NULL); data/mpg321-0.3.2/mpg321.c:1238: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). len = strlen(latin1); data/mpg321-0.3.2/mpg321.c:1245:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat (printable, latin1, tocopy); data/mpg321-0.3.2/mpg321.c:1263:19: [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(latin1); data/mpg321-0.3.2/mpg321.c:1270:13: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat (printable, latin1, tocopy); data/mpg321-0.3.2/mpg321.c:1277:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (retval, printable, maxlen); data/mpg321-0.3.2/mpg321.c:1280:11: [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(printable); data/mpg321-0.3.2/mpg321.c:1430:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(TTY_FILENO,output,size-1); data/mpg321-0.3.2/network.c:340:32: [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 (strncmp(arg, "raw://", strlen("raw://"))) data/mpg321-0.3.2/network.c:345: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). host = arg + strlen("raw://"); data/mpg321-0.3.2/network.c:374:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(tcp_sock, buf + offset, 1) < 0) data/mpg321-0.3.2/network.c:399:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(tcp_sock, buf + offset, 1) < 0) data/mpg321-0.3.2/network.c:434:37: [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). snprintf(path, sizeof(path) - strlen(host) - 75, "%s", request); data/mpg321-0.3.2/network.c:490:32: [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). send(tcp_sock, http_request, strlen(http_request), 0); data/mpg321-0.3.2/network.c:661:26: [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). pl[j] = (char*)calloc(strlen(equ),sizeof(char)); data/mpg321-0.3.2/network.c:692:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(tcp_sock, &c, sizeof(char)); data/mpg321-0.3.2/network.c:719:32: [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 (strncmp(arg, "ftp://", strlen("ftp://"))) data/mpg321-0.3.2/network.c:724: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). host = arg + strlen("ftp://"); data/mpg321-0.3.2/network.c:752:33: [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). send(tcp_sock, ftp_request, strlen(ftp_request), 0); data/mpg321-0.3.2/network.c:756:33: [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). send(tcp_sock, ftp_request, strlen(ftp_request), 0); data/mpg321-0.3.2/network.c:760:33: [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). send(tcp_sock, ftp_request, strlen(ftp_request), 0); data/mpg321-0.3.2/network.c:766:37: [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). send(tcp_sock, ftp_request, strlen(ftp_request), 0); data/mpg321-0.3.2/network.c:798:33: [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). send(tcp_sock, ftp_request, strlen(ftp_request), 0); data/mpg321-0.3.2/network.c:803:33: [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). send(tcp_sock, ftp_request, strlen(ftp_request), 0); data/mpg321-0.3.2/playlist.c:59:5: [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(pl->remote_file, ""); data/mpg321-0.3.2/playlist.c:113:24: [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). register int pos = strlen(str)-1; data/mpg321-0.3.2/playlist.c:121:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(str, ptr, pos+1); data/mpg321-0.3.2/playlist.c:137: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). while (strlen(pl->remote_file) == 0 && !quit_now) data/mpg321-0.3.2/playlist.c:212:32: [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). char *new_path = malloc(strlen(path)+strlen(entry->d_name)+2); data/mpg321-0.3.2/playlist.c:212:45: [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). char *new_path = malloc(strlen(path)+strlen(entry->d_name)+2); data/mpg321-0.3.2/playlist.c:243:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(pl->remote_file, file, PATH_MAX); data/mpg321-0.3.2/playlist.c:282: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). dirlen = strlen(directory); data/mpg321-0.3.2/playlist.c:288: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). if (strlen(playlist_buf) == 0 || playlist_buf[0] == '#') data/mpg321-0.3.2/playlist.c:298: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). pl->files[pl->numfiles] = malloc(strlen(playlist_buf) + dirlen + 2); data/mpg321-0.3.2/playlist.c:300:13: [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(pl->files[pl->numfiles], "/"); data/mpg321-0.3.2/remote.c:58:19: [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). alreadyread = strlen (remote_input_buf); data/mpg321-0.3.2/remote.c:62:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (!(numread = read(0, remote_input_buf + alreadyread, (sizeof(input)-1)-alreadyread)) > 0) data/mpg321-0.3.2/remote.c:80: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). linelen = strlen (remote_input_buf); data/mpg321-0.3.2/remote.c:90: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(input) == 0) data/mpg321-0.3.2/remote.c:249:10: [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 (remote_input_buf)) data/mpg321-0.3.2/remote.c:264:10: [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 (remote_input_buf)) ANALYSIS SUMMARY: Hits = 162 Lines analyzed = 6248 in approximately 0.20 seconds (31274 lines/second) Physical Source Lines of Code (SLOC) = 4560 Hits@level = [0] 159 [1] 58 [2] 74 [3] 12 [4] 18 [5] 0 Hits@level+ = [0+] 321 [1+] 162 [2+] 104 [3+] 30 [4+] 18 [5+] 0 Hits/KSLOC@level+ = [0+] 70.3947 [1+] 35.5263 [2+] 22.807 [3+] 6.57895 [4+] 3.94737 [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.