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/pam-u2f-1.1.0/b64.c
Examining data/pam-u2f-1.1.0/util.h
Examining data/pam-u2f-1.1.0/drop_privs.h
Examining data/pam-u2f-1.1.0/explicit_bzero.c
Examining data/pam-u2f-1.1.0/tests/get_devices.c
Examining data/pam-u2f-1.1.0/tests/basic.c
Examining data/pam-u2f-1.1.0/pam-u2f.c
Examining data/pam-u2f-1.1.0/pamu2fcfg/cmdline.h
Examining data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c
Examining data/pam-u2f-1.1.0/pamu2fcfg/_readpassphrase.h
Examining data/pam-u2f-1.1.0/pamu2fcfg/readpassphrase.c
Examining data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c
Examining data/pam-u2f-1.1.0/util.c
Examining data/pam-u2f-1.1.0/b64.h
Examining data/pam-u2f-1.1.0/drop_privs.c

FINAL RESULTS:

data/pam-u2f-1.1.0/pam-u2f.c:184:7:  [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, DEFAULT_ORIGIN_PREFIX);
data/pam-u2f-1.1.0/pam-u2f.c:192:7:  [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, SSH_ORIGIN);
data/pam-u2f-1.1.0/pam-u2f.c:378:7:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
      snprintf(buffer, BUFSIZE, DEFAULT_AUTHPENDING_FILE_PATH, getuid());
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:326: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(result, s);
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:114:10:  [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).
    if (!strcpy(buf, PAM_PREFIX)) {
data/pam-u2f-1.1.0/pamu2fcfg/readpassphrase.c:201:1:  [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.
getpass(const char *prompt)
data/pam-u2f-1.1.0/util.c:1810:5:  [4] (format) syslog:
  If syslog's format strings can be influenced by an attacker, they can be
  exploited (CWE-134). Use a constant format string for syslog.
    syslog(LOG_AUTHPRIV | LOG_DEBUG, DEBUG_STR, file, line, func);
data/pam-u2f-1.1.0/util.c:1813: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(debug_file, DEBUG_STR, file, line, func);
data/pam-u2f-1.1.0/util.c:1814:5:  [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(debug_file, fmt, ap);
data/pam-u2f-1.1.0/util.c:1818: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(debug_file, DEBUG_STR, file, line, func);
data/pam-u2f-1.1.0/util.c:1819:3:  [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(debug_file, fmt, ap);
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:560: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, "ho:i:t:rPNVdvu:n", long_options, &option_index);
data/pam-u2f-1.1.0/b64.c:51: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(*out, b64_ptr, (size_t) b64_len);
data/pam-u2f-1.1.0/pam-u2f.c:95:14:  [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,
data/pam-u2f-1.1.0/pam-u2f.c:162: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[BUFSIZE];
data/pam-u2f-1.1.0/pam-u2f.c:404: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).
      open(cfg->authpending_file,
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:295:13:  [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).
  outfile = fopen(filename, "w");
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:32: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[BUFSIZE];
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.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 prompt[BUFSIZE];
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:34: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 pin[BUFSIZE];
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:59: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 userid[32];
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:60: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 challenge[32];
data/pam-u2f-1.1.0/pamu2fcfg/readpassphrase.c:84:24:  [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).
	    (input = output = open(_PATH_TTY, O_RDWR)) == -1) {
data/pam-u2f-1.1.0/pamu2fcfg/readpassphrase.c:203: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.
	static char buf[_PASSWORD_LEN + 1];
data/pam-u2f-1.1.0/util.c:83: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(b64, websafe_b64, n);
data/pam-u2f-1.1.0/util.c:744: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 attributes[32] = {0};
data/pam-u2f-1.1.0/util.c:747:5:  [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(attributes, "+presence");
data/pam-u2f-1.1.0/util.c:752:5:  [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(attributes, "+verification");
data/pam-u2f-1.1.0/util.c:913: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[BUFSIZE];
data/pam-u2f-1.1.0/util.c:922: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(cfg->auth_file, O_RDONLY | O_CLOEXEC | O_NOCTTY);
data/pam-u2f-1.1.0/util.c:1141: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 challenge[32];
data/pam-u2f-1.1.0/util.c:1474: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 challenge[32];
data/pam-u2f-1.1.0/util.c:1484: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 prompt[MAX_PROMPT_LEN];
data/pam-u2f-1.1.0/util.c:1485: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[MAX_PROMPT_LEN];
data/pam-u2f-1.1.0/util.c:1834: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(RANDOM_DEV, O_RDONLY);
data/pam-u2f-1.1.0/b64.c:68: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 (in == NULL || ptr == NULL || len == NULL || strlen(in) > INT_MAX)
data/pam-u2f-1.1.0/b64.c:85: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).
  alloc_len = strlen(in);
data/pam-u2f-1.1.0/pam-u2f.c:186:32:  [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 (gethostname(buffer + strlen(DEFAULT_ORIGIN_PREFIX),
data/pam-u2f-1.1.0/pam-u2f.c:187:33:  [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).
                      BUFSIZE - strlen(DEFAULT_ORIGIN_PREFIX)) == -1) {
data/pam-u2f-1.1.0/pam-u2f.c:263:26:  [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).
      authfile_dir_len = strlen(pw->pw_dir) + strlen(default_authfile_dir) +
data/pam-u2f-1.1.0/pam-u2f.c:263:47:  [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).
      authfile_dir_len = strlen(pw->pw_dir) + strlen(default_authfile_dir) +
data/pam-u2f-1.1.0/pam-u2f.c:264:26:  [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(default_authfile) + 1;
data/pam-u2f-1.1.0/pam-u2f.c:280:26:  [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).
      authfile_dir_len = strlen(authfile_dir) + strlen(default_authfile) + 1;
data/pam-u2f-1.1.0/pam-u2f.c:280:49:  [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).
      authfile_dir_len = strlen(authfile_dir) + strlen(default_authfile) + 1;
data/pam-u2f-1.1.0/pam-u2f.c:310:9:  [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(pw->pw_dir) + strlen("/") + strlen(cfg->auth_file) + 1;
data/pam-u2f-1.1.0/pam-u2f.c:310: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).
        strlen(pw->pw_dir) + strlen("/") + strlen(cfg->auth_file) + 1;
data/pam-u2f-1.1.0/pam-u2f.c:310: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).
        strlen(pw->pw_dir) + strlen("/") + strlen(cfg->auth_file) + 1;
data/pam-u2f-1.1.0/pam-u2f.c:389:9:  [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(cfg->authpending_file) == 0) {
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:137:7:  [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(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:140:7:  [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(gengetopt_args_info_versiontext) > 0)
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:146:23:  [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_purpose = strlen(gengetopt_args_info_purpose);
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:147: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).
	size_t len_usage = strlen(gengetopt_args_info_usage);
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:160: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(gengetopt_args_info_description) > 0) {
data/pam-u2f-1.1.0/pamu2fcfg/cmdline.c:323:26:  [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).
  result = (char*)malloc(strlen(s) + 1);
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:118: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).
    if (gethostname(buf + strlen(PAM_PREFIX), BUFSIZE - strlen(PAM_PREFIX)) ==
data/pam-u2f-1.1.0/pamu2fcfg/pamu2fcfg.c:118:57:  [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 (gethostname(buf + strlen(PAM_PREFIX), BUFSIZE - strlen(PAM_PREFIX)) ==
data/pam-u2f-1.1.0/pamu2fcfg/readpassphrase.c:133:31:  [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).
		(void)write(output, prompt, strlen(prompt));
data/pam-u2f-1.1.0/pamu2fcfg/readpassphrase.c:136:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') {
data/pam-u2f-1.1.0/util.c:45:29:  [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 (ascii_hex == NULL || (strlen(ascii_hex) % 2) != 0)
data/pam-u2f-1.1.0/util.c:48: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).
  *blob_len = strlen(ascii_hex) / 2;
data/pam-u2f-1.1.0/util.c:75:7:  [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).
  n = strlen(websafe_b64);
data/pam-u2f-1.1.0/util.c:155: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).
    size_t len = strlen(buf);
data/pam-u2f-1.1.0/util.c:348:7:  [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(buf) != SSH_HEADER_LEN ||
data/pam-u2f-1.1.0/util.c:357:10:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    ch = fgetc(opwfile);
data/pam-u2f-1.1.0/util.c:374:13:  [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(cp) != SSH_TRAILER_LEN ||
data/pam-u2f-1.1.0/util.c:395: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).
  decoded_len = strlen(buf);
data/pam-u2f-1.1.0/util.c:1385:31:  [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).
          explicit_bzero(pin, strlen(pin));
data/pam-u2f-1.1.0/util.c:1838:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  n = read(fd, buf, cnt);

ANALYSIS SUMMARY:

Hits = 68
Lines analyzed = 5574 in approximately 0.18 seconds (31335 lines/second)
Physical Source Lines of Code (SLOC) = 4352
Hits@level = [0]  70 [1]  33 [2]  23 [3]   1 [4]  11 [5]   0
Hits@level+ = [0+] 138 [1+]  68 [2+]  35 [3+]  12 [4+]  11 [5+]   0
Hits/KSLOC@level+ = [0+] 31.7096 [1+] 15.625 [2+] 8.04228 [3+] 2.75735 [4+] 2.52757 [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.