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/doscan-0.3.3/lib/getopt.c
Examining data/doscan-0.3.3/lib/getopt.h
Examining data/doscan-0.3.3/lib/getopt1.c
Examining data/doscan-0.3.3/src/doscan.cc
Examining data/doscan-0.3.3/src/engine_tcp.cc
Examining data/doscan-0.3.3/src/engine_tcp.h
Examining data/doscan-0.3.3/src/event_queue.cc
Examining data/doscan-0.3.3/src/event_queue.h
Examining data/doscan-0.3.3/src/event_queue_epoll.cc
Examining data/doscan-0.3.3/src/event_queue_epoll.h
Examining data/doscan-0.3.3/src/event_queue_poll.cc
Examining data/doscan-0.3.3/src/event_queue_poll.h
Examining data/doscan-0.3.3/src/half_duplex.cc
Examining data/doscan-0.3.3/src/half_duplex.h
Examining data/doscan-0.3.3/src/ipv4.cc
Examining data/doscan-0.3.3/src/ipv4.h
Examining data/doscan-0.3.3/src/opt.cc
Examining data/doscan-0.3.3/src/opt.h
Examining data/doscan-0.3.3/src/proto.cc
Examining data/doscan-0.3.3/src/proto.h
Examining data/doscan-0.3.3/src/proto_http.cc
Examining data/doscan-0.3.3/src/proto_http_proxy.cc
Examining data/doscan-0.3.3/src/proto_ident_check.cc
Examining data/doscan-0.3.3/src/proto_tcp.cc
Examining data/doscan-0.3.3/src/proto_udp.cc
Examining data/doscan-0.3.3/src/quote.cc
Examining data/doscan-0.3.3/src/results.cc
Examining data/doscan-0.3.3/src/results.h
Examining data/doscan-0.3.3/src/rx.cc
Examining data/doscan-0.3.3/src/rx.h
Examining data/doscan-0.3.3/src/scan.cc
Examining data/doscan-0.3.3/src/scan.h
Examining data/doscan-0.3.3/src/scan_tcp.cc
Examining data/doscan-0.3.3/src/scan_tcp.h
Examining data/doscan-0.3.3/src/scan_trigger.cc
Examining data/doscan-0.3.3/src/scan_trigger.h
Examining data/doscan-0.3.3/src/scan_udp.cc
Examining data/doscan-0.3.3/src/scan_udp.h
Examining data/doscan-0.3.3/src/subnets.cc
Examining data/doscan-0.3.3/src/subnets.h
Examining data/doscan-0.3.3/src/tcp_server.cc
Examining data/doscan-0.3.3/src/tcp_server.h
Examining data/doscan-0.3.3/src/ticks.cc
Examining data/doscan-0.3.3/src/ticks.h
Examining data/doscan-0.3.3/src/utils.cc
Examining data/doscan-0.3.3/src/utils.h

FINAL RESULTS:

data/doscan-0.3.3/src/proto_http_proxy.cc:190:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(buf, "GET http://%s:%u/doscan-probe/%u HTTP/1.0\r\n\r\n",
data/doscan-0.3.3/src/proto_http_proxy.cc:197:5:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    sprintf(buf, "CONNECT %s:%u HTTP/1.0\r\n\r\n",
data/doscan-0.3.3/lib/getopt.c:215:9:  [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.
#ifndef getenv
data/doscan-0.3.3/lib/getopt.c:216:14:  [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.
extern char *getenv ();
data/doscan-0.3.3/lib/getopt.c:408:21:  [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.
  posixly_correct = getenv ("POSIXLY_CORRECT");
data/doscan-0.3.3/lib/getopt.c:973:1:  [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.
getopt (argc, argv, optstring)
data/doscan-0.3.3/lib/getopt.c:1003:11:  [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.
      c = getopt (argc, argv, "abc:d:0123456789");
data/doscan-0.3.3/lib/getopt.h:113:12:  [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.
extern int getopt (int argc, char *const *argv, const char *shortopts);
data/doscan-0.3.3/lib/getopt.h:116:12:  [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.
extern int getopt ();
data/doscan-0.3.3/lib/getopt.h:121:12:  [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.
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
data/doscan-0.3.3/lib/getopt.h:133:12:  [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.
extern int getopt ();
data/doscan-0.3.3/lib/getopt.h:134:12:  [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.
extern int getopt_long ();
data/doscan-0.3.3/lib/getopt1.c:69:1:  [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.
getopt_long (argc, argv, options, long_options, opt_index)
data/doscan-0.3.3/lib/getopt1.c:125:11:  [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.
      c = getopt_long (argc, argv, "abc:d:0123456789",
data/doscan-0.3.3/src/doscan.cc:73:9:  [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.
    c = getopt_long (argc, argv, "a:A:b:c:Ehino:p:P:r:s:S:t:vV",
data/doscan-0.3.3/src/engine_tcp.cc:95:5:  [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 (e->buffer, buffer, size);
data/doscan-0.3.3/src/engine_tcp.cc:406: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 buffer[e->size];
data/doscan-0.3.3/src/ipv4.cc:49:3:  [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 (result, "%u.%u.%u.%u", a, b, c, d);
data/doscan-0.3.3/src/ipv4.cc:78:3:  [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 (result, "%u.%u.%u.%u/%u", a, b, c, d, (unsigned)source->length);
data/doscan-0.3.3/src/ipv4.h:26: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.
typedef char ipv4_string_t[15 + 3 + 1];
data/doscan-0.3.3/src/proto.cc:30:16:  [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).
  proto_open_t open;
data/doscan-0.3.3/src/proto.cc:40:69:  [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).
proto_register (const char *name, proto_start_t start, proto_open_t open)
data/doscan-0.3.3/src/proto.cc:46:13:  [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).
  p->open = open;
data/doscan-0.3.3/src/proto.cc:59:26:  [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).
      selected_open = p->open;
data/doscan-0.3.3/src/proto_http_proxy.cc:118: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).
    return atoi(matches[2].data().c_str());
data/doscan-0.3.3/src/proto_http_proxy.cc:185: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 buf[100];
data/doscan-0.3.3/src/proto_http_proxy.cc:453: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).
  listen_port = atoi(opt_receive);
data/doscan-0.3.3/src/proto_ident_check.cc:107: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 request[50];
data/doscan-0.3.3/src/proto_ident_check.cc:108:7:  [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(request, "%u , %u\r\n", port(), local_port);
data/doscan-0.3.3/src/proto_ident_check.cc:143:39:  [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).
            || (static_cast<unsigned>(atoi(matches[1].data().c_str()))
data/doscan-0.3.3/src/proto_ident_check.cc:145:39:  [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).
            || (static_cast<unsigned>(atoi(matches[2].data().c_str()))
data/doscan-0.3.3/src/results.cc:317: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 buffer[length * 4 + 1];
data/doscan-0.3.3/src/results.cc:362: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 (result, buffer, target - buffer);
data/doscan-0.3.3/src/scan_udp.cc:135: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 data[65536];
data/doscan-0.3.3/src/subnets.cc:176:16:  [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).
  FILE* file = fopen(name, "r");
data/doscan-0.3.3/src/subnets.cc:186: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 buf[30];
data/doscan-0.3.3/src/ticks.cc:104:3:  [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 (result, "%04d-%02d-%02d %02d:%02d:%02d.%03u",
data/doscan-0.3.3/src/ticks.h:38: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.
typedef char ticks_string_t[70];
data/doscan-0.3.3/src/utils.cc:33: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 temp[len];
data/doscan-0.3.3/src/utils.cc:116: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 (target, temp, *result_size);
data/doscan-0.3.3/lib/getopt.c:238:51:  [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 (!defined __STDC__ || !__STDC__) && !defined strlen
data/doscan-0.3.3/lib/getopt.c:241: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).
extern int strlen (const char *);
data/doscan-0.3.3/lib/getopt.c:439:44:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	      int len = nonoption_flags_max_len = strlen (orig_str);
data/doscan-0.3.3/lib/getopt.c:660:21:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
		== (unsigned int) strlen (p->name))
data/doscan-0.3.3/lib/getopt.c:684: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).
	  nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:715:21:  [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).
		      nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:732: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).
		  nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:737: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).
	  nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:848:51:  [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 ((unsigned int) (nameend - nextchar) == strlen (p->name))
data/doscan-0.3.3/lib/getopt.c:871: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).
	    nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:891: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).
		    nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:905: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).
		    nextchar += strlen (nextchar);
data/doscan-0.3.3/lib/getopt.c:909: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).
	    nextchar += strlen (nextchar);
data/doscan-0.3.3/src/engine_tcp.cc:335:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  result = read (s->poll->fd, e->buffer + e->offset,
data/doscan-0.3.3/src/engine_tcp.cc:409:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  result = read (s->poll->fd, buffer, e->size);
data/doscan-0.3.3/src/event_queue_epoll.cc:169:7:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
      usleep(1000 * timeout);
data/doscan-0.3.3/src/event_queue_poll.cc:128:7:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
      usleep(1000 * timeout);
data/doscan-0.3.3/src/half_duplex.cc:108:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int result = read(fd(), &receive_buffer[current_size], to_read);
data/doscan-0.3.3/src/proto_tcp.cc:130:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      result = read(fd(), &receive_buffer[0] + receive_offset,
data/doscan-0.3.3/src/proto_tcp.cc:293:55:  [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).
      receive_regexp_terminate_on_match = opt_receive[strlen (opt_receive) - 1] == '$';
data/doscan-0.3.3/src/results.cc:95: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).
  format_list = new format_t[strlen (format) + 1];
data/doscan-0.3.3/src/scan_tcp.cc:264:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  int result = ::read(fd(), &data[offset], remaining);
data/doscan-0.3.3/src/subnets.cc:189:20:  [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_t len = strlen(buf);
data/doscan-0.3.3/src/utils.cc:32: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).
  unsigned len = strlen (escaped);

ANALYSIS SUMMARY:

Hits = 64
Lines analyzed = 8548 in approximately 0.23 seconds (36872 lines/second)
Physical Source Lines of Code (SLOC) = 5466
Hits@level = [0] 137 [1]  24 [2]  25 [3]  13 [4]   2 [5]   0
Hits@level+ = [0+] 201 [1+]  64 [2+]  40 [3+]  15 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 36.7728 [1+] 11.7087 [2+] 7.31797 [3+] 2.74424 [4+] 0.365898 [5+]   0
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.