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/dumpasn1-20191022/dumpasn1.c

FINAL RESULTS:

data/dumpasn1-20191022/dumpasn1.c:561:2:  [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( *buffer, attribute );
data/dumpasn1-20191022/dumpasn1.c:988:2:  [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( pathBuffer, pathTemplate );
data/dumpasn1-20191022/dumpasn1.c:989:2:  [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( pathBuffer, CONFIG_NAME );
data/dumpasn1-20191022/dumpasn1.c:1040:2:  [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( path, newPath );
data/dumpasn1-20191022/dumpasn1.c:1088: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( buffer + endPos, CONFIG_NAME );
data/dumpasn1-20191022/dumpasn1.c:1099: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( buffer, path );
data/dumpasn1-20191022/dumpasn1.c:1100: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( buffer + ( int ) ( namePos - ( char * ) path ), CONFIG_NAME );
data/dumpasn1-20191022/dumpasn1.c:1121:4:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
			sprintf( buffer, "%s/%s", pathPtr, CONFIG_NAME );
data/dumpasn1-20191022/dumpasn1.c:1140: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( progNameStart + 1, CONFIG_NAME );
data/dumpasn1-20191022/dumpasn1.c:1202:11:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	length = vfprintf( output, format, argPtr );
data/dumpasn1-20191022/dumpasn1.c:1218:3:  [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( output, printDots ? ". " : \
data/dumpasn1-20191022/dumpasn1.c:1235:2:  [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( output, message, messageParam );
data/dumpasn1-20191022/dumpasn1.c:1024:22:  [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( ( envString = getenv( envName ) ) != NULL )
data/dumpasn1-20191022/dumpasn1.c:1115: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.
	if( ( envPath = getenv( "PATH" ) ) != NULL )
data/dumpasn1-20191022/dumpasn1.c:771: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( oidInfo->oid, binaryOID, oidIndex );
data/dumpasn1-20191022/dumpasn1.c:813: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 buffer[ MAX_LINESIZE ];
data/dumpasn1-20191022/dumpasn1.c:817:15:  [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( path, "rb" ) ) == NULL )
data/dumpasn1-20191022/dumpasn1.c:973:15:  [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( path, "rb" ) ) == NULL )
data/dumpasn1-20191022/dumpasn1.c:984: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 pathBuffer[ FILENAME_MAX ], newPath[ FILENAME_MAX ];
data/dumpasn1-20191022/dumpasn1.c:1004:4:  [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( newPath + newPathPos, pathBuffer + pathPos,
data/dumpasn1-20191022/dumpasn1.c:1013:4:  [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 envName[ MAX_LINESIZE ], *envString;
data/dumpasn1-20191022/dumpasn1.c:1020:4:  [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( envName, pathBuffer + pathPos, i );
data/dumpasn1-20191022/dumpasn1.c:1030: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( newPath + newPathPos, envString, envStrLen );
data/dumpasn1-20191022/dumpasn1.c:1047: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 buffer[ FILENAME_MAX ];
data/dumpasn1-20191022/dumpasn1.c:1053: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 filePath[ _MAX_PATH ];
data/dumpasn1-20191022/dumpasn1.c:1087:4:  [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( buffer, path, endPos );
data/dumpasn1-20191022/dumpasn1.c:1183: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 convBuffer[ 2 ];
data/dumpasn1-20191022/dumpasn1.c:1334: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 outBuf[ 8 ];
data/dumpasn1-20191022/dumpasn1.c:1380:3:  [2] (buffer) wchar_t:
  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.
		wchar_t wChString[ 2 ];
data/dumpasn1-20191022/dumpasn1.c:1470: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 printable[ 9 ];
data/dumpasn1-20191022/dumpasn1.c:1623:14:  [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.
			length += sprintf( textOID + length, "..." );
data/dumpasn1-20191022/dumpasn1.c:1662:15:  [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.
				length += sprintf( textOID + length,
data/dumpasn1-20191022/dumpasn1.c:1720:14:  [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.
				length = sprintf( textOID, "%ld %ld", x, y );
data/dumpasn1-20191022/dumpasn1.c:1731:15:  [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.
				length += sprintf( textOID + length, " %ld", value );
data/dumpasn1-20191022/dumpasn1.c:1862: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 timeStr[ 64 ];
data/dumpasn1-20191022/dumpasn1.c:1914:15:  [2] (buffer) wchar_t:
  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.
        const wchar_t wCh[2] ={ ( ch << 8 ) | getc( inFile ),0};
data/dumpasn1-20191022/dumpasn1.c:1932:4:  [2] (buffer) wchar_t:
  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.
			wchar_t wCh[2] = { 0, 0 };
data/dumpasn1-20191022/dumpasn1.c:2347: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 buffer[ 16 ];
data/dumpasn1-20191022/dumpasn1.c:2790:4:  [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 textOID[ 128 ];
data/dumpasn1-20191022/dumpasn1.c:3257: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 pathPtr[ FILENAME_MAX ];
data/dumpasn1-20191022/dumpasn1.c:3304:14:  [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).
				offset = atol( argPtr );
data/dumpasn1-20191022/dumpasn1.c:3333:22:  [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( ( outFile = fopen( argPtr + 1, "wb" ) ) == NULL )
data/dumpasn1-20191022/dumpasn1.c:3359:21:  [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).
					maxNestLevel = atoi( argPtr + 1 );
data/dumpasn1-20191022/dumpasn1.c:3414:20:  [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).
					outputWidth = atoi( argPtr + 1 );
data/dumpasn1-20191022/dumpasn1.c:3464: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( ( inFile = fopen( argv[ 0 ], "rb" ) ) == NULL )
data/dumpasn1-20191022/dumpasn1.c:556: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).
	if( ( *buffer = ( char * ) malloc( strlen( attribute ) + 1 ) ) == NULL )
data/dumpasn1-20191022/dumpasn1.c:631:18:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while( ( ( ch = getc( file ) ) == ' ' || ch == '\t' ) && !feof( file ) );
data/dumpasn1-20191022/dumpasn1.c:651:10:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				ch = getc( file );
data/dumpasn1-20191022/dumpasn1.c:666:8:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ch = getc( file );
data/dumpasn1-20191022/dumpasn1.c:672:14:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if( ( ch = getc( file ) ) != '\n' )
data/dumpasn1-20191022/dumpasn1.c:688:13:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			( void ) getc( file );
data/dumpasn1-20191022/dumpasn1.c:990:12:  [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).
	pathLen = strlen( pathBuffer );
data/dumpasn1-20191022/dumpasn1.c:1026:27:  [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).
				const int envStrLen = strlen( envString );
data/dumpasn1-20191022/dumpasn1.c:1097:6:  [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( path ) < FILENAME_MAX - 13 && namePos != NULL )
data/dumpasn1-20191022/dumpasn1.c:1416:10:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	value = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1426:18:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		const int ch = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1520:8:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ch = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1579:10:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				ch = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1764:15:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		bitString = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1774:18:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		const int ch = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1898:8:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ch = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1914:47:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        const wchar_t wCh[2] ={ ( ch << 8 ) | getc( inFile ),0};
data/dumpasn1-20191022/dumpasn1.c:1931:25:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			const int secondCh = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:1946:26:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					const int thirdCh = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2015:5:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
				getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2044:13:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int ch = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2113:34:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	tag = item->header[ index++ ] = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2129:12:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			value = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2141:11:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	length = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2165:13:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			int ch = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2487:19:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			const int ch = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2687:9:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			ch = getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:2727:15:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			if( ( ch = getc( inFile ) ) != 0 )
data/dumpasn1-20191022/dumpasn1.c:2824:6:  [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).
					strlen( oidInfo->description ) + 2 + length >= outputWidth )
data/dumpasn1-20191022/dumpasn1.c:3146:21:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
					const int ch = fgetc( inFile );
data/dumpasn1-20191022/dumpasn1.c:3274:2:  [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( pathPtr, "/" );
data/dumpasn1-20191022/dumpasn1.c:3474:4:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			getc( inFile );
data/dumpasn1-20191022/dumpasn1.c:3510:10:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			putc( getc( inFile ), outFile );

ANALYSIS SUMMARY:

Hits = 78
Lines analyzed = 3553 in approximately 0.12 seconds (30774 lines/second)
Physical Source Lines of Code (SLOC) = 2569
Hits@level = [0]  48 [1]  33 [2]  31 [3]   2 [4]  12 [5]   0
Hits@level+ = [0+] 126 [1+]  78 [2+]  45 [3+]  14 [4+]  12 [5+]   0
Hits/KSLOC@level+ = [0+] 49.0463 [1+] 30.362 [2+] 17.5165 [3+] 5.44959 [4+] 4.67108 [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.