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/apachetop-0.19.7/src/apachetop.cc
Examining data/apachetop-0.19.7/src/apachetop.h
Examining data/apachetop-0.19.7/src/circle.h
Examining data/apachetop-0.19.7/src/display.cc
Examining data/apachetop-0.19.7/src/display.h
Examining data/apachetop-0.19.7/src/filters.cc
Examining data/apachetop-0.19.7/src/filters.h
Examining data/apachetop-0.19.7/src/hits_circle.cc
Examining data/apachetop-0.19.7/src/hits_circle.h
Examining data/apachetop-0.19.7/src/inlines.cc
Examining data/apachetop-0.19.7/src/log.cc
Examining data/apachetop-0.19.7/src/log.h
Examining data/apachetop-0.19.7/src/map.cc
Examining data/apachetop-0.19.7/src/map.h
Examining data/apachetop-0.19.7/src/ohtbl.cc
Examining data/apachetop-0.19.7/src/ohtbl.h
Examining data/apachetop-0.19.7/src/pcre_cpp_wrapper.h
Examining data/apachetop-0.19.7/src/queue.cc
Examining data/apachetop-0.19.7/src/queue.h
Examining data/apachetop-0.19.7/src/resolver.cc
Examining data/apachetop-0.19.7/src/resolver.h
Examining data/apachetop-0.19.7/src/timed_circle.cc
Examining data/apachetop-0.19.7/src/timed_circle.h

FINAL RESULTS:

data/apachetop-0.19.7/src/apachetop.cc:1131:17:  [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.
                vfprintf(d, fmt, args);
data/apachetop-0.19.7/src/apachetop.cc:139:15:  [3] (buffer) getopt:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
	while ((ch = getopt(argc, argv, "f:H:T:hvqlrs:pd:")) != -1)
data/apachetop-0.19.7/src/apachetop.cc:970:7:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
	if ((realpath(filename, realfile) == NULL))
data/apachetop-0.19.7/src/apachetop.cc:52: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 buf[32768], *bufcp, *nextline;
data/apachetop-0.19.7/src/apachetop.cc:154:9:  [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).
				x = atoi(optarg);
data/apachetop-0.19.7/src/apachetop.cc:163:9:  [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).
				x = atoi(optarg);
data/apachetop-0.19.7/src/apachetop.cc:185:9:  [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).
				x = atoi(optarg);
data/apachetop-0.19.7/src/apachetop.cc:195:9:  [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).
				x = atoi(optarg);
data/apachetop-0.19.7/src/apachetop.cc:651: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).
			if ((nd = atoi(t)) != 0)
data/apachetop-0.19.7/src/apachetop.cc:967: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 realfile[MAXPATHLEN];
data/apachetop-0.19.7/src/apachetop.cc:1008:12:  [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(realfile, O_RDONLY)) == -1)
data/apachetop-0.19.7/src/apachetop.cc:1119:16:  [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 fileName[1024] = {'\0'};
data/apachetop-0.19.7/src/apachetop.cc:1123:10:  [2] (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 string.
        	strcpy( fileName, "/tmp/atop.XXXXXX" );
data/apachetop-0.19.7/src/apachetop.cc:1128:30:  [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 (cf.debug && (d = fopen(fileName, "a")))
data/apachetop-0.19.7/src/apachetop.h:114:7:  [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).
	bool open; /* is the file open or not? */
data/apachetop-0.19.7/src/display.cc:298: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 active_filters[20];
data/apachetop-0.19.7/src/display.cc:303:4:  [2] (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 string.
			strcat(active_filters, "URLs ");
data/apachetop-0.19.7/src/display.cc:305:4:  [2] (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 string.
			strcat(active_filters, "HOSTs ");
data/apachetop-0.19.7/src/display.cc:307:4:  [2] (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 string.
			strcat(active_filters, "REFs ");
data/apachetop-0.19.7/src/display.cc:361: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(&scf, &cf, sizeof(struct config));
data/apachetop-0.19.7/src/display.cc:649: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(&scf, &cf, sizeof(struct config));
data/apachetop-0.19.7/src/display.cc:904: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 str[MAX_IP_STR_WIDTH];
data/apachetop-0.19.7/src/display.cc:1017: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(&tmp, &items[i], P_S_S);
data/apachetop-0.19.7/src/display.cc:1018: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(&items[i], &items[j], P_S_S);
data/apachetop-0.19.7/src/display.cc:1019: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(&items[j], &tmp, P_S_S);
data/apachetop-0.19.7/src/display.cc:1135: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 horiz_line[128];
data/apachetop-0.19.7/src/display.cc:1148: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 line[hist_width + 1];
data/apachetop-0.19.7/src/hits_circle.cc:68: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(posptr, &lb, sizeof(lb));
data/apachetop-0.19.7/src/log.cc:156:15:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	b->retcode = atoi(bufcp);
data/apachetop-0.19.7/src/log.cc:160: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).
	b->bytes = atoi(bufcp);
data/apachetop-0.19.7/src/pcre_cpp_wrapper.h:173: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 buffer[1024];
data/apachetop-0.19.7/src/timed_circle.cc:149: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(hit, &lb, sizeof(lb));
data/apachetop-0.19.7/src/apachetop.cc:445:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
			buflen = read(fd, buf, sizeof(buf));
data/apachetop-0.19.7/src/apachetop.cc:1121: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).
       	if ( !strlen( fileName ) )
data/apachetop-0.19.7/src/apachetop.cc:1125:10:  [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( fileName, "/debug", sizeof(fileName) - strlen(fileName) - 1 );
data/apachetop-0.19.7/src/apachetop.cc:1125:58:  [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, "/debug", sizeof(fileName) - strlen(fileName) - 1 );
data/apachetop-0.19.7/src/display.cc:311: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).
			y = COLS - (strlen(active_filters) + 11);
data/apachetop-0.19.7/src/pcre_cpp_wrapper.h:117:84:  [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 pcre_exec(re, pe, lastsubject = subject, slen = (len >= 0) ? len : strlen(subject), 0, options, ovector, 3*substrcount) > 0;

ANALYSIS SUMMARY:

Hits = 38
Lines analyzed = 4630 in approximately 0.13 seconds (35476 lines/second)
Physical Source Lines of Code (SLOC) = 3005
Hits@level = [0]  11 [1]   6 [2]  29 [3]   2 [4]   1 [5]   0
Hits@level+ = [0+]  49 [1+]  38 [2+]  32 [3+]   3 [4+]   1 [5+]   0
Hits/KSLOC@level+ = [0+] 16.3062 [1+] 12.6456 [2+] 10.6489 [3+] 0.998336 [4+] 0.332779 [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.