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/yubikey-server-c-0.5/src/util.c
Examining data/yubikey-server-c-0.5/src/main.c
Examining data/yubikey-server-c-0.5/src/util.h

FINAL RESULTS:

data/yubikey-server-c-0.5/src/main.c:164:8:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		t += sprintf(t, "h=%s\n", signature);
data/yubikey-server-c-0.5/src/main.c:167:8:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		t += sprintf(t, "info=%s\n", info);
data/yubikey-server-c-0.5/src/main.c:170:8:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		t += sprintf(t, "timestamp=%s\n", timestamp);
data/yubikey-server-c-0.5/src/main.c:173:8:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
		t += sprintf(t, "status=%s\n", status);
data/yubikey-server-c-0.5/src/main.c:578: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 ((opt = getopt(argc, argv, "c:p:vfh")) != -1) {
data/yubikey-server-c-0.5/src/main.c:190:8:  [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.
	const char *paramValues[1];
data/yubikey-server-c-0.5/src/main.c:224: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(*shared_secret, PQgetvalue(res, 0, 0), *shared_secret_len);
data/yubikey-server-c-0.5/src/main.c:246: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(*user, otp, i);
data/yubikey-server-c-0.5/src/main.c:255: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(*s_otp, otp + i, j);
data/yubikey-server-c-0.5/src/main.c:264:8:  [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.
	const char *paramValues[3];
data/yubikey-server-c-0.5/src/main.c:265: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 ctr[10], use[10];
data/yubikey-server-c-0.5/src/main.c:301:8:  [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.
	const char *paramValues[1];
data/yubikey-server-c-0.5/src/main.c:511: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[4096];
data/yubikey-server-c-0.5/src/main.c:514:6:  [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(file, "r");
data/yubikey-server-c-0.5/src/main.c:640:10:  [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).
	pidfd = fopen(conf.pidfile, "wx");
data/yubikey-server-c-0.5/src/util.c:31: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(r, p, len);
data/yubikey-server-c-0.5/src/util.c:66:4:  [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(&tvv, tv, sizeof(struct timeval));
data/yubikey-server-c-0.5/src/util.c:128:42:  [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 void ysc_b64_encodeblock(unsigned char in[3], unsigned char out[4], int len)
data/yubikey-server-c-0.5/src/util.c:128:63:  [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 void ysc_b64_encodeblock(unsigned char in[3], unsigned char out[4], int len)
data/yubikey-server-c-0.5/src/util.c:143:11:  [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 out[4];
data/yubikey-server-c-0.5/src/util.c:147: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(tmp, out, 4);
data/yubikey-server-c-0.5/src/util.c:155:48:  [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 void ysc_b64_decodeblock(unsigned const char in[4], unsigned char out[3])
data/yubikey-server-c-0.5/src/util.c:155:69:  [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 void ysc_b64_decodeblock(unsigned const char in[4], unsigned char out[3])
data/yubikey-server-c-0.5/src/util.c:166:11:  [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 out[3];
data/yubikey-server-c-0.5/src/util.c:178: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(tmp, out, 3);
data/yubikey-server-c-0.5/src/main.c:76: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).
	size_t len = strlen("YYYY-mm-ddTHH:MM:SSZMSMS");
data/yubikey-server-c-0.5/src/main.c:103: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).
	gcry_md_write(hd, line, strlen(line));
data/yubikey-server-c-0.5/src/main.c:134: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).
	gcry_md_write(hd, line, strlen(line));
data/yubikey-server-c-0.5/src/main.c:154:8:  [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).
	r_l = strlen("h=\nstatus=\ntimestamp=\ninfo="); /* This is a maximum
data/yubikey-server-c-0.5/src/main.c:156: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).
	r_l += (signature != NULL ? strlen(signature) : 0);
data/yubikey-server-c-0.5/src/main.c:157: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).
	r_l += (status != NULL ? strlen(status) : 0);
data/yubikey-server-c-0.5/src/main.c:158:25:  [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).
	r_l += (info != NULL ? strlen(info) : 0);
data/yubikey-server-c-0.5/src/main.c:159: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).
	r_l += (timestamp != NULL ? strlen(timestamp) : 0);
data/yubikey-server-c-0.5/src/main.c:177:43:  [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).
	response = MHD_create_response_from_data(strlen(resp_text), resp_text,
data/yubikey-server-c-0.5/src/main.c:236: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).
	otp_len = strlen(otp);
data/yubikey-server-c-0.5/src/main.c:409: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(otp) < (YUBIKEY_BLOCK_SIZE * 2 + 1)) {
data/yubikey-server-c-0.5/src/util.c:40: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).
		haystack += strlen(needle);
data/yubikey-server-c-0.5/src/util.c:59: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 fdup_len = strlen(format) + ysc_nstrstr(format, "%v") * 2;
data/yubikey-server-c-0.5/src/util.c:70: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).
	flen = strlen(format);
data/yubikey-server-c-0.5/src/util.c:164: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).
	ssize_t len = strlen(s);

ANALYSIS SUMMARY:

Hits = 40
Lines analyzed = 889 in approximately 0.04 seconds (24512 lines/second)
Physical Source Lines of Code (SLOC) = 700
Hits@level = [0]  24 [1]  15 [2]  20 [3]   1 [4]   4 [5]   0
Hits@level+ = [0+]  64 [1+]  40 [2+]  25 [3+]   5 [4+]   4 [5+]   0
Hits/KSLOC@level+ = [0+] 91.4286 [1+] 57.1429 [2+] 35.7143 [3+] 7.14286 [4+] 5.71429 [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.