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/cstream-3.1.1/cstream.c

FINAL RESULTS:

data/cstream-3.1.1/cstream.c:971:5:  [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(f, format, num / 1024.0 / 1024.0 / 1024.0);
data/cstream-3.1.1/cstream.c:974:5:  [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(f, format, num / 1024.0 / 1024.0);
data/cstream-3.1.1/cstream.c:977:5:  [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(f, format, num / 1024.0);
data/cstream-3.1.1/cstream.c:980:5:  [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(f, format, num);
data/cstream-3.1.1/cstream.c:353:12:  [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 ((s = getenv("CSTREAM_AUDIO_BITRATE"))) {
data/cstream-3.1.1/cstream.c:1703:16:  [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, "b:B:c:i:I:n:o:O:p:St:T:v:Vl6:")) != -1) {
data/cstream-3.1.1/cstream.c:354:18:  [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).
    so.so_rate = atol(s);
data/cstream-3.1.1/cstream.c:469: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).
      serv_addr.sin_port = htons(atoi(port));
data/cstream-3.1.1/cstream.c:480:30:  [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).
      sin6.sin6_port = htons(atoi(port));
data/cstream-3.1.1/cstream.c:499:49:  [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).
      fprintf(stderr, "Accepting on port %d\n", atoi(port));
data/cstream-3.1.1/cstream.c:524:32:  [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).
    serv_addr.sin_port = htons(atoi(port));
data/cstream-3.1.1/cstream.c:547:9:  [2] (buffer) bcopy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
        bcopy(*a, &serv_addr.sin_addr.s_addr, sizeof(struct in_addr));
data/cstream-3.1.1/cstream.c:593: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.
        char name[8192];
data/cstream-3.1.1/cstream.c:594: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.
        char addr_string[INET6_ADDRSTRLEN];
data/cstream-3.1.1/cstream.c:600:11:  [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(addr_string, "unknown");
data/cstream-3.1.1/cstream.c:635: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 data[8192];
data/cstream-3.1.1/cstream.c:641: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 hostname[8192];
data/cstream-3.1.1/cstream.c:642: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 service[8192];
data/cstream-3.1.1/cstream.c:663: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).
      fd = open(filename, flags, mode);
data/cstream-3.1.1/cstream.c:719:20:  [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).
      state->ofd = open(o->o, flags, mode);
data/cstream-3.1.1/cstream.c:741: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).
  state->ofd = open(o->o, flags, mode);
data/cstream-3.1.1/cstream.c:813:20:  [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).
      state->ifd = open(o->i, O_RDWR);
data/cstream-3.1.1/cstream.c:832:15:  [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).
	state->ifd = open(o->i, flags);
data/cstream-3.1.1/cstream.c:900:9:  [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).
    f = fopen(o->p, "w");
data/cstream-3.1.1/cstream.c:1081: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(state->pmalloc.data, buf, n_bytes);
data/cstream-3.1.1/cstream.c:1705: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).
    case 'v': o.v = atoi(optarg); break;
data/cstream-3.1.1/cstream.c:1708: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).
    case 'c': o.c = atoi(optarg); break;
data/cstream-3.1.1/cstream.c:1724: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).
      o.T = atoi(optarg);
data/cstream-3.1.1/cstream.c:1727: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).
      if (!atoi(optarg) != 0) {
data/cstream-3.1.1/cstream.c:1731: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).
      o.six = atoi(optarg);
data/cstream-3.1.1/cstream.c:1233:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(state->ifd, curread, o->n - state->bytes_transferred);
data/cstream-3.1.1/cstream.c:1235:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(state->ifd, curread, state->b);
data/cstream-3.1.1/cstream.c:1425:6:  [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((theory - sofar) * 1000000.0);
data/cstream-3.1.1/cstream.c:1445:6:  [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(time_to_sleep);
data/cstream-3.1.1/cstream.c:1470:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	  nbytes = read(state->ifd, curbuf, o->n - bytes_read);
data/cstream-3.1.1/cstream.c:1477:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	  nbytes = read(state->ifd, curbuf, state->b);
data/cstream-3.1.1/cstream.c:1683: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).
    c = tolower(s[strlen(s)-1]);

ANALYSIS SUMMARY:

Hits = 37
Lines analyzed = 1783 in approximately 0.07 seconds (23824 lines/second)
Physical Source Lines of Code (SLOC) = 1484
Hits@level = [0]  93 [1]   7 [2]  24 [3]   2 [4]   4 [5]   0
Hits@level+ = [0+] 130 [1+]  37 [2+]  30 [3+]   6 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 87.6011 [1+] 24.9326 [2+] 20.2156 [3+] 4.04313 [4+] 2.69542 [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.