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/mp3wrap-0.5/wrap.c
Examining data/mp3wrap-0.5/wrap.h
Examining data/mp3wrap-0.5/mp3wrap.h
Examining data/mp3wrap-0.5/crc.c
Examining data/mp3wrap-0.5/crc.h
Examining data/mp3wrap-0.5/mp3wrap.c

FINAL RESULTS:

data/mp3wrap-0.5/mp3wrap.c:77:2:  [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 (NAME" Version "VERSION" "DATE". See README and COPYING for more!\n");
data/mp3wrap-0.5/mp3wrap.c:127:34:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
	if ((ptr=getenv("HOME"))!=NULL) sprintf(filename, "%s/"CONFFILE, ptr);
data/mp3wrap-0.5/mp3wrap.c:142:7:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
						sprintf (ext, "_"WRAP"_%s", ptr);
data/mp3wrap-0.5/mp3wrap.c:409:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		sprintf (wrapindex, "mv -f "TEMPFILE" %s", argv[2]);
data/mp3wrap-0.5/mp3wrap.c:410:7:  [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 (wrapindex)==-1)
data/mp3wrap-0.5/mp3wrap.c:81:17:  [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 ((option=getopt(argc, argv, "lav"))!=EOF) {
data/mp3wrap-0.5/mp3wrap.c:127:11:  [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 ((ptr=getenv("HOME"))!=NULL) sprintf(filename, "%s/"CONFFILE, ptr);
data/mp3wrap-0.5/mp3wrap.c:36: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 id3[ID3LEN] = {
data/mp3wrap-0.5/mp3wrap.c:72: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 filename[512], *wrapindex, c, ext[512];
data/mp3wrap-0.5/mp3wrap.c:132:18:  [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_input=fopen(CONFFILE, "r"))||(file_input=fopen(filename, "r"))) {
data/mp3wrap-0.5/mp3wrap.c:132:53:  [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_input=fopen(CONFFILE, "r"))||(file_input=fopen(filename, "r"))) {
data/mp3wrap-0.5/mp3wrap.c:178:20:  [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_input=fopen(argv[2], "r"))) {
data/mp3wrap-0.5/mp3wrap.c:296: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).
			if (!(file_input=fopen(argv[i+2+optoffset], "r"))) {
data/mp3wrap-0.5/mp3wrap.c:316: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 ((file_input=fopen(filename, "r"))) {
data/mp3wrap-0.5/mp3wrap.c:327:20:  [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_output=fopen(filename, "w+"))) {
data/mp3wrap-0.5/mp3wrap.c:346:20:  [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_input=fopen(argv[2], "r"))) {
data/mp3wrap-0.5/mp3wrap.c:375:20:  [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_input=fopen(argv[i+2+optoffset], "r"))) {
data/mp3wrap-0.5/crc.c:111:7:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		c = fgetc(in);
data/mp3wrap-0.5/mp3wrap.c:128:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	else strncpy(filename, CONFFILE, strlen(CONFFILE));
data/mp3wrap-0.5/mp3wrap.c:128:35:  [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).
	else strncpy(filename, CONFFILE, strlen(CONFFILE));
data/mp3wrap-0.5/mp3wrap.c:130:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(ext, EXT, 511);
data/mp3wrap-0.5/mp3wrap.c:136: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(filename)>1) {
data/mp3wrap-0.5/mp3wrap.c:137: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).
					if (filename[strlen(filename)-1] == '\n') filename[strlen(filename)-1] = '\0';
data/mp3wrap-0.5/mp3wrap.c:137:57:  [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 (filename[strlen(filename)-1] == '\n') filename[strlen(filename)-1] = '\0';
data/mp3wrap-0.5/mp3wrap.c:138: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).
					if (filename[strlen(filename)-1] == '\r') filename[strlen(filename)-1] = '\0';
data/mp3wrap-0.5/mp3wrap.c:138:57:  [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 (filename[strlen(filename)-1] == '\r') filename[strlen(filename)-1] = '\0';
data/mp3wrap-0.5/mp3wrap.c:144:11:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
					else strncpy(ext, ptr, 511);
data/mp3wrap-0.5/mp3wrap.c:192:8:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if (fgetc(file_input)=='W')
data/mp3wrap-0.5/mp3wrap.c:193:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			  if (fgetc(file_input)=='R')
data/mp3wrap-0.5/mp3wrap.c:194:12:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			    if (fgetc(file_input)=='A')
data/mp3wrap-0.5/mp3wrap.c:195:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				if (fgetc(file_input)=='P') {
data/mp3wrap-0.5/mp3wrap.c:202:12:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if (((c=fgetc(file_input))<INDEXVERSION)&&addoption) {
data/mp3wrap-0.5/mp3wrap.c:210:15:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			oldfiles = fgetc(file_input);
data/mp3wrap-0.5/mp3wrap.c:220:10:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					if (getchar()!='y')
data/mp3wrap-0.5/mp3wrap.c:233: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).
				indexsize = indexsize + begin - PADDING - (strlen(TAG) + 8);
data/mp3wrap-0.5/mp3wrap.c:258:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					c = fgetc(file_input);
data/mp3wrap-0.5/mp3wrap.c:310:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy (filename, argv[1+optoffset], strlen(argv[1+optoffset]));
data/mp3wrap-0.5/mp3wrap.c:310:41:  [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).
		strncpy (filename, argv[1+optoffset], strlen(argv[1+optoffset]));
data/mp3wrap-0.5/mp3wrap.c:312: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(filename)>4) && ((strstr(filename, ".mp3"))!=NULL))
data/mp3wrap-0.5/mp3wrap.c:313: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).
				filename[strlen(filename)-4]='\0';
data/mp3wrap-0.5/mp3wrap.c:314:4:  [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 (filename, ext, strlen(ext));
data/mp3wrap-0.5/mp3wrap.c:314: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).
			strncat (filename, ext, strlen(ext));
data/mp3wrap-0.5/mp3wrap.c:319:8:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if (getchar()!='y')
data/mp3wrap-0.5/mp3wrap.c:325:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy (filename, TEMPFILE, strlen(TEMPFILE));
data/mp3wrap-0.5/mp3wrap.c:325: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).
		strncpy (filename, TEMPFILE, strlen(TEMPFILE));
data/mp3wrap-0.5/mp3wrap.c:360:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			fputc(fgetc(file_input), file_output);
data/mp3wrap-0.5/mp3wrap.c:385:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			fputc(fgetc(file_input), file_output);
data/mp3wrap-0.5/mp3wrap.c:412:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(filename, argv[2], strlen(argv[2])+1);
data/mp3wrap-0.5/mp3wrap.c:412:30:  [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).
		strncpy(filename, argv[2], strlen(argv[2])+1);
data/mp3wrap-0.5/wrap.c:36: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 (pos<strlen(s))
data/mp3wrap-0.5/wrap.c:43:6:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (fgetc(file_input)=='T')
data/mp3wrap-0.5/wrap.c:44:9:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	   if (fgetc(file_input)=='A')
data/mp3wrap-0.5/wrap.c:45:12:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	      if (fgetc(file_input)=='G')
data/mp3wrap-0.5/wrap.c:60: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).
		size += strlen(argv[i+2+optoffset])+1;
data/mp3wrap-0.5/wrap.c:61: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).
	return (size + strlen(TAG)+(files+2)*4 + PADDING + CRCLEN);
data/mp3wrap-0.5/wrap.c:70:2:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
	strncpy(wrapindex, TAG, strlen(TAG));
data/mp3wrap-0.5/wrap.c:70: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).
	strncpy(wrapindex, TAG, strlen(TAG));
data/mp3wrap-0.5/wrap.c:107:6:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	if (fgetc(in)=='I')
data/mp3wrap-0.5/wrap.c:108:7:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (fgetc(in)=='D')
data/mp3wrap-0.5/wrap.c:109:8:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if (fgetc(in)=='3') {
data/mp3wrap-0.5/wrap.c:111:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				c1 = fgetc(in);
data/mp3wrap-0.5/wrap.c:112:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				c2 = fgetc(in);
data/mp3wrap-0.5/wrap.c:113:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				c3 = fgetc(in);
data/mp3wrap-0.5/wrap.c:114:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				c4 = fgetc(in);
data/mp3wrap-0.5/wrap.c:127:11:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		head |= fgetc(in);

ANALYSIS SUMMARY:

Hits = 65
Lines analyzed = 787 in approximately 0.04 seconds (17618 lines/second)
Physical Source Lines of Code (SLOC) = 559
Hits@level = [0]  61 [1]  48 [2]  10 [3]   2 [4]   5 [5]   0
Hits@level+ = [0+] 126 [1+]  65 [2+]  17 [3+]   7 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 225.403 [1+] 116.279 [2+] 30.4114 [3+] 12.5224 [4+] 8.94454 [5+]   0
Dot directories skipped = 2 (--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.