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/glibc-doc-reference-2.31/manual/examples/mbstouwcs.c
Examining data/glibc-doc-reference-2.31/manual/examples/atexit.c
Examining data/glibc-doc-reference-2.31/manual/examples/isockad.c
Examining data/glibc-doc-reference-2.31/manual/examples/dir.c
Examining data/glibc-doc-reference-2.31/manual/examples/timeval_subtract.c
Examining data/glibc-doc-reference-2.31/manual/examples/mkisock.c
Examining data/glibc-doc-reference-2.31/manual/examples/mkfsock.c
Examining data/glibc-doc-reference-2.31/manual/examples/strftim.c
Examining data/glibc-doc-reference-2.31/manual/examples/mygetpass.c
Examining data/glibc-doc-reference-2.31/manual/examples/setjmp.c
Examining data/glibc-doc-reference-2.31/manual/examples/search.c
Examining data/glibc-doc-reference-2.31/manual/examples/execinfo.c
Examining data/glibc-doc-reference-2.31/manual/examples/ofdlocks.c
Examining data/glibc-doc-reference-2.31/manual/examples/genpass.c
Examining data/glibc-doc-reference-2.31/manual/examples/memstrm.c
Examining data/glibc-doc-reference-2.31/manual/examples/testpass.c
Examining data/glibc-doc-reference-2.31/manual/examples/sigh1.c
Examining data/glibc-doc-reference-2.31/manual/examples/argp-ex3.c
Examining data/glibc-doc-reference-2.31/manual/examples/inetsrv.c
Examining data/glibc-doc-reference-2.31/manual/examples/argp-ex1.c
Examining data/glibc-doc-reference-2.31/manual/examples/twalk.c
Examining data/glibc-doc-reference-2.31/manual/examples/strdupa.c
Examining data/glibc-doc-reference-2.31/manual/examples/sigusr.c
Examining data/glibc-doc-reference-2.31/manual/examples/rprintf.c
Examining data/glibc-doc-reference-2.31/manual/examples/swapcontext.c
Examining data/glibc-doc-reference-2.31/manual/examples/termios.c
Examining data/glibc-doc-reference-2.31/manual/examples/filesrv.c
Examining data/glibc-doc-reference-2.31/manual/examples/mkdirent.c
Examining data/glibc-doc-reference-2.31/manual/examples/argp-ex2.c
Examining data/glibc-doc-reference-2.31/manual/examples/inetcli.c
Examining data/glibc-doc-reference-2.31/manual/examples/add.c
Examining data/glibc-doc-reference-2.31/manual/examples/pipe.c
Examining data/glibc-doc-reference-2.31/manual/examples/memopen.c
Examining data/glibc-doc-reference-2.31/manual/examples/stpcpy.c
Examining data/glibc-doc-reference-2.31/manual/examples/select.c
Examining data/glibc-doc-reference-2.31/manual/examples/dir2.c
Examining data/glibc-doc-reference-2.31/manual/examples/testopt.c
Examining data/glibc-doc-reference-2.31/manual/examples/subopt.c
Examining data/glibc-doc-reference-2.31/manual/examples/db.c
Examining data/glibc-doc-reference-2.31/manual/examples/longopt.c
Examining data/glibc-doc-reference-2.31/manual/examples/popen.c
Examining data/glibc-doc-reference-2.31/manual/examples/fmtmsgexpl.c
Examining data/glibc-doc-reference-2.31/manual/examples/argp-ex4.c
Examining data/glibc-doc-reference-2.31/manual/examples/filecli.c
Examining data/glibc-doc-reference-2.31/manual/stdio-fp.c

FINAL RESULTS:

data/glibc-doc-reference-2.31/manual/examples/argp-ex4.c:174: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 (j == 0 ? "%s" : ", %s", arguments.strings[j]);
data/glibc-doc-reference-2.31/manual/examples/filecli.c:45: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 (name.sun_path, SERVER);
data/glibc-doc-reference-2.31/manual/examples/genpass.c:49:10:  [4] (crypto) crypt:
  The crypt functions use a poor one-way hashing algorithm; since they only
  accept passwords of 8 characters or fewer and only a two-byte salt, they
  are excessively vulnerable to dictionary attacks given today's faster
  computing equipment (CWE-327). Use a different algorithm, such as SHA-256,
  with a larger, non-repeating salt.
  hash = crypt (getpass ("Enter new passphrase: "), salt);
data/glibc-doc-reference-2.31/manual/examples/genpass.c:49:17:  [4] (misc) getpass:
  This function is obsolete and not portable. It was in SUSv2 but removed by
  POSIX.2. What it does exactly varies considerably between systems,
  particularly in where its prompt is displayed and where it gets its data
  (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations
  overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do
  exactly what you want. If you continue to use it, or write your own, be
  sure to zero the password as soon as possible to avoid leaving the
  cleartext password visible in the process' address space.
  hash = crypt (getpass ("Enter new passphrase: "), salt);
data/glibc-doc-reference-2.31/manual/examples/popen.c:40:12:  [4] (shell) popen:
  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.
  output = popen ("more", "w");
data/glibc-doc-reference-2.31/manual/examples/testpass.c:36:12:  [4] (misc) getpass:
  This function is obsolete and not portable. It was in SUSv2 but removed by
  POSIX.2. What it does exactly varies considerably between systems,
  particularly in where its prompt is displayed and where it gets its data
  (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations
  overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do
  exactly what you want. If you continue to use it, or write your own, be
  sure to zero the password as soon as possible to avoid leaving the
  cleartext password visible in the process' address space.
  phrase = getpass ("Enter passphrase: ");
data/glibc-doc-reference-2.31/manual/examples/testpass.c:42:15:  [4] (crypto) crypt:
  The crypt functions use a poor one-way hashing algorithm; since they only
  accept passwords of 8 characters or fewer and only a two-byte salt, they
  are excessively vulnerable to dictionary attacks given today's faster
  computing equipment (CWE-327). Use a different algorithm, such as SHA-256,
  with a larger, non-repeating salt.
  if (strcmp (crypt (phrase, hash_sha), hash_sha))
data/glibc-doc-reference-2.31/manual/examples/testpass.c:50:15:  [4] (crypto) crypt:
  The crypt functions use a poor one-way hashing algorithm; since they only
  accept passwords of 8 characters or fewer and only a two-byte salt, they
  are excessively vulnerable to dictionary attacks given today's faster
  computing equipment (CWE-327). Use a different algorithm, such as SHA-256,
  with a larger, non-repeating salt.
  if (strcmp (crypt (phrase, hash_md5), hash_md5))
data/glibc-doc-reference-2.31/manual/examples/testpass.c:58:15:  [4] (crypto) crypt:
  The crypt functions use a poor one-way hashing algorithm; since they only
  accept passwords of 8 characters or fewer and only a two-byte salt, they
  are excessively vulnerable to dictionary attacks given today's faster
  computing equipment (CWE-327). Use a different algorithm, such as SHA-256,
  with a larger, non-repeating salt.
  if (strcmp (crypt (phrase, hash_des), hash_des))
data/glibc-doc-reference-2.31/manual/examples/longopt.c:49: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:f:",
data/glibc-doc-reference-2.31/manual/examples/subopt.c:52: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 ((opt = getopt (argc, argv, "at:o:")) != -1)
data/glibc-doc-reference-2.31/manual/examples/testopt.c:37: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 ((c = getopt (argc, argv, "abc:")) != -1)
data/glibc-doc-reference-2.31/manual/examples/argp-ex3.c:98: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 *args[2];		/* @var{arg1} & @var{arg2} */
data/glibc-doc-reference-2.31/manual/examples/argp-ex4.c:110: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).
      arguments->repeat_count = arg ? atoi (arg) : 10;
data/glibc-doc-reference-2.31/manual/examples/filecli.c:35: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 message[MAXMSG];
data/glibc-doc-reference-2.31/manual/examples/filesrv.c:31: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 message[MAXMSG];
data/glibc-doc-reference-2.31/manual/examples/genpass.c:25:12:  [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 ubytes[16];
data/glibc-doc-reference-2.31/manual/examples/genpass.c:26: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 salt[20];
data/glibc-doc-reference-2.31/manual/examples/inetsrv.c: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 buffer[MAXMSG];
data/glibc-doc-reference-2.31/manual/examples/mkdirent.c:40: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->d_name, name, name_length + 1);
data/glibc-doc-reference-2.31/manual/examples/ofdlocks.c:35: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[256];
data/glibc-doc-reference-2.31/manual/examples/ofdlocks.c:42:8:  [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 ("/tmp/foo", O_RDWR | O_CREAT, 0666);
data/glibc-doc-reference-2.31/manual/examples/ofdlocks.c:49:13:  [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.
      len = sprintf (buf, "%d: tid=%ld fd=%d\n", i, tid, fd);
data/glibc-doc-reference-2.31/manual/examples/setjmp.c:44: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[128];
data/glibc-doc-reference-2.31/manual/examples/stpcpy.c:24: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[10];
data/glibc-doc-reference-2.31/manual/examples/strftim.c:26: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[SIZE];
data/glibc-doc-reference-2.31/manual/examples/subopt.c:75:27:  [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).
              read_size = atoi (value);
data/glibc-doc-reference-2.31/manual/examples/subopt.c:80:28:  [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).
              write_size = atoi (value);
data/glibc-doc-reference-2.31/manual/examples/swapcontext.c:77: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 st1[8192];
data/glibc-doc-reference-2.31/manual/examples/swapcontext.c:78: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 st2[8192];
data/glibc-doc-reference-2.31/manual/examples/filecli.c:46: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).
  size = strlen (name.sun_path) + sizeof (name.sun_family);
data/glibc-doc-reference-2.31/manual/examples/filecli.c:49: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).
  nbytes = sendto (sock, MESSAGE, strlen (MESSAGE) + 1, 0,
data/glibc-doc-reference-2.31/manual/examples/inetcli.c:36: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).
  nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1);
data/glibc-doc-reference-2.31/manual/examples/inetsrv.c:36:12:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  nbytes = read (filedes, buffer, MAXMSG);
data/glibc-doc-reference-2.31/manual/examples/mbstouwcs.c:12: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).
  size_t len = strlen (s) + 1;
data/glibc-doc-reference-2.31/manual/examples/memopen.c:28: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).
  stream = fmemopen (buffer, strlen (buffer), "r");
data/glibc-doc-reference-2.31/manual/examples/memopen.c:29:16:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while ((ch = fgetc (stream)) != EOF)
data/glibc-doc-reference-2.31/manual/examples/mkdirent.c:28:24:  [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 name_length = strlen (name);
data/glibc-doc-reference-2.31/manual/examples/mkfsock.c:43:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy (name.sun_path, filename, sizeof (name.sun_path));
data/glibc-doc-reference-2.31/manual/examples/mkfsock.c:53: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 (name.sun_path));
data/glibc-doc-reference-2.31/manual/examples/ofdlocks.c:59: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 (1);
data/glibc-doc-reference-2.31/manual/examples/pipe.c:31:15:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while ((c = fgetc (stream)) != EOF)
data/glibc-doc-reference-2.31/manual/examples/termios.c:69:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
      read (STDIN_FILENO, &c, 1);

ANALYSIS SUMMARY:

Hits = 43
Lines analyzed = 2946 in approximately 0.15 seconds (19308 lines/second)
Physical Source Lines of Code (SLOC) = 1576
Hits@level = [0]  66 [1]  13 [2]  18 [3]   3 [4]   9 [5]   0
Hits@level+ = [0+] 109 [1+]  43 [2+]  30 [3+]  12 [4+]   9 [5+]   0
Hits/KSLOC@level+ = [0+] 69.1624 [1+] 27.2843 [2+] 19.0355 [3+] 7.61421 [4+] 5.71066 [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.