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/libp11-0.4.11/src/libp11-int.h
Examining data/libp11-0.4.11/src/eng_parse.c
Examining data/libp11-0.4.11/src/p11_ec.c
Examining data/libp11-0.4.11/src/libpkcs11.c
Examining data/libp11-0.4.11/src/p11_pkey.c
Examining data/libp11-0.4.11/src/eng_err.c
Examining data/libp11-0.4.11/src/p11_misc.c
Examining data/libp11-0.4.11/src/p11_rsa.c
Examining data/libp11-0.4.11/src/eng_back.c
Examining data/libp11-0.4.11/src/p11_front.c
Examining data/libp11-0.4.11/src/eng_front.c
Examining data/libp11-0.4.11/src/p11_cert.c
Examining data/libp11-0.4.11/src/p11_load.c
Examining data/libp11-0.4.11/src/p11_key.c
Examining data/libp11-0.4.11/src/p11_attr.c
Examining data/libp11-0.4.11/src/p11_slot.c
Examining data/libp11-0.4.11/src/p11_ckr.c
Examining data/libp11-0.4.11/src/p11_err.h
Examining data/libp11-0.4.11/src/eng_err.h
Examining data/libp11-0.4.11/src/p11_atfork.c
Examining data/libp11-0.4.11/src/p11_err.c
Examining data/libp11-0.4.11/src/pkcs11.h
Examining data/libp11-0.4.11/src/libp11.h
Examining data/libp11-0.4.11/src/engine.h
Examining data/libp11-0.4.11/tests/fork-test.c
Examining data/libp11-0.4.11/tests/openssl_version.c
Examining data/libp11-0.4.11/tests/fork-change-slot.c
Examining data/libp11-0.4.11/tests/check-privkey.c
Examining data/libp11-0.4.11/tests/rsa-pss-sign.c
Examining data/libp11-0.4.11/tests/list-tokens.c
Examining data/libp11-0.4.11/tests/evp-sign.c
Examining data/libp11-0.4.11/tests/rsa-oaep.c
Examining data/libp11-0.4.11/examples/auth.c
Examining data/libp11-0.4.11/examples/decrypt.c
Examining data/libp11-0.4.11/examples/getrandom.c
Examining data/libp11-0.4.11/examples/listkeys.c

FINAL RESULTS:

data/libp11-0.4.11/src/eng_back.c:82:2:  [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(stderr, format, ap);
data/libp11-0.4.11/src/engine.h:77:24:  [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.
	__attribute__((format(printf, 3, 4)))
data/libp11-0.4.11/tests/fork-test.c:133: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(password, argv[2]);
data/libp11-0.4.11/examples/auth.c:218:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	rc = read(fd, random, RANDOM_SIZE);
data/libp11-0.4.11/examples/auth.c:252:29:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	rc = PKCS11_sign(NID_sha1, random, RANDOM_SIZE,
data/libp11-0.4.11/examples/auth.c:269:28:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	rc = RSA_verify(NID_sha1, random, RANDOM_SIZE,
data/libp11-0.4.11/examples/auth.c:286:6:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (random != NULL)
data/libp11-0.4.11/examples/auth.c:287:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		OPENSSL_free(random);
data/libp11-0.4.11/examples/decrypt.c:143:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	rc = read(fd, random, RANDOM_SIZE);
data/libp11-0.4.11/examples/decrypt.c:183:40:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	len = RSA_public_encrypt(RANDOM_SIZE, random, encrypted,
data/libp11-0.4.11/examples/decrypt.c:270:13:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (memcmp(random, decrypted, RANDOM_SIZE) != 0) {
data/libp11-0.4.11/examples/decrypt.c:281:6:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (random != NULL)
data/libp11-0.4.11/examples/decrypt.c:282:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		OPENSSL_free(random);
data/libp11-0.4.11/examples/getrandom.c:46:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	unsigned char random[10];
data/libp11-0.4.11/examples/getrandom.c:91:15:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	len = sizeof(random);
data/libp11-0.4.11/examples/getrandom.c:92:36:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	rc = PKCS11_generate_random(slot, random, len);
data/libp11-0.4.11/examples/getrandom.c:102:19:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		printf("%02X ", random[i]);
data/libp11-0.4.11/src/eng_back.c:228:8:  [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.
	mod = getenv("PKCS11_MODULE_PATH");
data/libp11-0.4.11/tests/fork-change-slot.c:170:19:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    unsigned char random[RANDOM_SIZE], signature[MAX_SIGSIZE];
data/libp11-0.4.11/tests/fork-change-slot.c:260:21:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    if (!RAND_bytes(random, RANDOM_SIZE)){
data/libp11-0.4.11/tests/fork-change-slot.c:274:32:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    if (EVP_SignUpdate(md_ctx, random, RANDOM_SIZE) <= 0) {
data/libp11-0.4.11/tests/fork-change-slot.c:295:34:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    if (EVP_VerifyUpdate(md_ctx, random, RANDOM_SIZE) <= 0) {
data/libp11-0.4.11/tests/fork-test.c:177:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	rc = read(fd, random, RANDOM_SIZE);
data/libp11-0.4.11/tests/fork-test.c:225:29:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (EVP_SignUpdate(md_ctx, random, RANDOM_SIZE) <= 0) {
data/libp11-0.4.11/tests/fork-test.c:253:31:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (EVP_VerifyUpdate(md_ctx, random, RANDOM_SIZE) <= 0) {
data/libp11-0.4.11/tests/fork-test.c:270:6:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	if (random != NULL)
data/libp11-0.4.11/tests/fork-test.c:271:16:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		OPENSSL_free(random);
data/libp11-0.4.11/examples/auth.c:66: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 password[20];
data/libp11-0.4.11/examples/auth.c:210: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).
	fd = open(RANDOM_SOURCE, O_RDONLY);
data/libp11-0.4.11/examples/decrypt.c:66: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 password[20];
data/libp11-0.4.11/examples/decrypt.c:135: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).
	fd = open(RANDOM_SOURCE, O_RDONLY);
data/libp11-0.4.11/examples/getrandom.c:46: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 random[10];
data/libp11-0.4.11/src/eng_back.c:383: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 cert_id[MAX_VALUE_LEN / 2];
data/libp11-0.4.11/src/eng_back.c:386: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 tmp_pin[MAX_PIN_LENGTH+1];
data/libp11-0.4.11/src/eng_back.c:389: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 flags[64];
data/libp11-0.4.11/src/eng_back.c:412:6:  [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(ctx->pin, tmp_pin, tmp_pin_len);
data/libp11-0.4.11/src/eng_back.c:454: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(flags, "uninitialized, ");
data/libp11-0.4.11/src/eng_back.c:456: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(flags, "no pin, ");
data/libp11-0.4.11/src/eng_back.c:458: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(flags, "login, ");
data/libp11-0.4.11/src/eng_back.c:460: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(flags, "ro, ");
data/libp11-0.4.11/src/eng_back.c:462:4:  [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(flags, "no token");
data/libp11-0.4.11/src/eng_back.c:672: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 key_id[MAX_VALUE_LEN / 2];
data/libp11-0.4.11/src/eng_back.c:676: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 tmp_pin[MAX_PIN_LENGTH+1];
data/libp11-0.4.11/src/eng_back.c:678: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 flags[64];
data/libp11-0.4.11/src/eng_back.c:708:6:  [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(ctx->pin, tmp_pin, tmp_pin_len);
data/libp11-0.4.11/src/eng_back.c:750: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(flags, "uninitialized, ");
data/libp11-0.4.11/src/eng_back.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(flags, "no pin, ");
data/libp11-0.4.11/src/eng_back.c:754: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(flags, "login, ");
data/libp11-0.4.11/src/eng_back.c:756: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(flags, "ro, ");
data/libp11-0.4.11/src/eng_back.c:758:4:  [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(flags, "no token");
data/libp11-0.4.11/src/eng_parse.c:236: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 tmp[3];
data/libp11-0.4.11/src/libp11-int.h:96: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 id[255];
data/libp11-0.4.11/src/libp11-int.h:109: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 id[255];
data/libp11-0.4.11/src/p11_attr.c:125: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(ap->pValue, data, size);
data/libp11-0.4.11/src/p11_attr.c:149: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 temp[1024];
data/libp11-0.4.11/src/p11_cert.c:290: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 md[EVP_MAX_MD_SIZE];
data/libp11-0.4.11/src/p11_ec.c:88: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, m, sizeof(ECDSA_METHOD));
data/libp11-0.4.11/src/p11_ec.c:130: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, m, sizeof(ECDH_METHOD));
data/libp11-0.4.11/src/p11_ec.c:429: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 sigret[512]; /* HACK for now */
data/libp11-0.4.11/src/p11_ec.c:687: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, buf, outlen);
data/libp11-0.4.11/src/p11_key.c:358: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 pin[MAX_PIN_LENGTH+1];
data/libp11-0.4.11/src/p11_misc.c:37: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(res, mem, size);
data/libp11-0.4.11/src/p11_pkey.c:154: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((int *)dst + 2, (int *)src + 2, 25 * sizeof(void (*)()));
data/libp11-0.4.11/src/p11_rsa.c:428: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(ret, meth, sizeof(RSA_METHOD));
data/libp11-0.4.11/src/pkcs11.h:198: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 manufacturer_id[32];
data/libp11-0.4.11/src/pkcs11.h:200: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 library_description[32];
data/libp11-0.4.11/src/pkcs11.h:215: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 slot_description[64];
data/libp11-0.4.11/src/pkcs11.h:216: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 manufacturer_id[32];
data/libp11-0.4.11/src/pkcs11.h:231: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 label[32];
data/libp11-0.4.11/src/pkcs11.h:232: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 manufacturer_id[32];
data/libp11-0.4.11/src/pkcs11.h:233: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 model[16];
data/libp11-0.4.11/src/pkcs11.h:234: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 serial_number[16];
data/libp11-0.4.11/src/pkcs11.h:248: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 utc_time[16];
data/libp11-0.4.11/src/pkcs11.h:496: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 year[4];
data/libp11-0.4.11/src/pkcs11.h:497: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 month[2];
data/libp11-0.4.11/src/pkcs11.h:498: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 day[2];
data/libp11-0.4.11/tests/check-privkey.c:40: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 buf[120];
data/libp11-0.4.11/tests/check-privkey.c:135: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).
		cert_fp = fopen(certfile, "rb");
data/libp11-0.4.11/tests/evp-sign.c:127: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 buf[120];
data/libp11-0.4.11/tests/evp-sign.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 buf[4096];
data/libp11-0.4.11/tests/fork-change-slot.c:170:14:  [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 random[RANDOM_SIZE], signature[MAX_SIGSIZE];
data/libp11-0.4.11/tests/fork-test.c:76: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 password[20];
data/libp11-0.4.11/tests/fork-test.c:170: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).
	fd = open(RANDOM_SOURCE, O_RDONLY);
data/libp11-0.4.11/tests/rsa-oaep.c:43: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 buf[120];
data/libp11-0.4.11/tests/rsa-oaep.c:63: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 data[32];
data/libp11-0.4.11/tests/rsa-oaep.c:66: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 dec[4096];
data/libp11-0.4.11/tests/rsa-oaep.c:69: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 enc[4096];
data/libp11-0.4.11/tests/rsa-pss-sign.c:42: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 buf[120];
data/libp11-0.4.11/tests/rsa-pss-sign.c:65: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 sig[4096];
data/libp11-0.4.11/tests/rsa-pss-sign.c:68: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 md[128];
data/libp11-0.4.11/examples/auth.c:113:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(password, argv[2], sizeof password);
data/libp11-0.4.11/examples/auth.c:143: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).
		rc = strlen(password);
data/libp11-0.4.11/examples/auth.c:167:22:  [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).
	memset(password, 0, strlen(password));
data/libp11-0.4.11/examples/auth.c:218:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	rc = read(fd, random, RANDOM_SIZE);
data/libp11-0.4.11/examples/decrypt.c:143:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	rc = read(fd, random, RANDOM_SIZE);
data/libp11-0.4.11/examples/decrypt.c:226: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).
	rc = strlen(password);
data/libp11-0.4.11/examples/decrypt.c:235:22:  [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).
	memset(password, 0, strlen(password));
data/libp11-0.4.11/src/eng_back.c:464: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).
		if ((m = strlen(flags)) != 0) {
data/libp11-0.4.11/src/eng_back.c:760: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).
		if ((m = strlen(flags)) != 0) {
data/libp11-0.4.11/src/eng_back.c:1022: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).
	ctx->pin_length = strlen(ctx->pin);
data/libp11-0.4.11/src/eng_parse.c:98:36:  [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 (strspn(slot_id, HEXDIGITS) == strlen(slot_id)) {
data/libp11-0.4.11/src/eng_parse.c:100: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).
		if ((strlen(slot_id) + 1) / 2 > *id_len) {
data/libp11-0.4.11/src/eng_parse.c:122:45:  [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 (strspn(slot_id + i, HEXDIGITS) + i != strlen(slot_id)) {
data/libp11-0.4.11/src/eng_parse.c:127: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).
		if ((strlen(slot_id) - i + 1) / 2 > *id_len) {
data/libp11-0.4.11/src/eng_parse.c:137:45:  [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 (strspn(slot_id + 3, HEXDIGITS) + 3 != strlen(slot_id)) {
data/libp11-0.4.11/src/eng_parse.c:142: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).
		if ((strlen(slot_id) - 3 + 1) / 2 > *id_len) {
data/libp11-0.4.11/src/eng_parse.c:188:53:  [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 (strspn(slot_id + i + 3, HEXDIGITS) + 3 + i != strlen(slot_id)) {
data/libp11-0.4.11/src/eng_parse.c:193: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).
		if ((strlen(slot_id) - i - 3 + 1) / 2 > *id_len) {
data/libp11-0.4.11/src/eng_parse.c:281: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).
		*field_len = strlen(field);
data/libp11-0.4.11/src/eng_parse.c:338:14:  [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).
			end = p + strlen(p);
data/libp11-0.4.11/src/p11_attr.c:144:34:  [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).
	pkcs11_addattr(ap, type, s, s ? strlen(s) : 0); /* RFC2279 string an unpadded string of CK_UTF8CHARs with no null-termination */
data/libp11-0.4.11/src/p11_key.c:398: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).
			(CK_UTF8CHAR *)pin, strlen(pin)));
data/libp11-0.4.11/src/p11_slot.c:243: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).
			(CK_UTF8CHAR *) pin, pin ? (unsigned long) strlen(pin) : 0));
data/libp11-0.4.11/src/p11_slot.c:250: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).
			OPENSSL_cleanse(spriv->prev_pin, strlen(spriv->prev_pin));
data/libp11-0.4.11/src/p11_slot.c:310:41:  [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).
			(CK_UTF8CHAR *) pin, (unsigned long) strlen(pin),
data/libp11-0.4.11/src/p11_slot.c:342: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).
	len = pin ? (int) strlen(pin) : 0;
data/libp11-0.4.11/src/p11_slot.c:364:28:  [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).
	old_len = old_pin ? (int) strlen(old_pin) : 0;
data/libp11-0.4.11/src/p11_slot.c:365:28:  [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).
	new_len = new_pin ? (int) strlen(new_pin) : 0;
data/libp11-0.4.11/src/p11_slot.c:469: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).
			OPENSSL_cleanse(spriv->prev_pin, strlen(spriv->prev_pin));
data/libp11-0.4.11/tests/fork-test.c:143:22:  [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).
	memset(password, 0, strlen(password));
data/libp11-0.4.11/tests/fork-test.c:177:7:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	rc = read(fd, random, RANDOM_SIZE);

ANALYSIS SUMMARY:

Hits = 121
Lines analyzed = 12295 in approximately 0.42 seconds (29174 lines/second)
Physical Source Lines of Code (SLOC) = 8798
Hits@level = [0] 216 [1]  31 [2]  63 [3]  24 [4]   3 [5]   0
Hits@level+ = [0+] 337 [1+] 121 [2+]  90 [3+]  27 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 38.3042 [1+] 13.7531 [2+] 10.2296 [3+] 3.06888 [4+] 0.340987 [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.