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/tpm2-pkcs11-1.2.0/test/integration/pkcs-find-objects.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-initialize-finalize.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-misc.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-keygen.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/test.h Examining data/tpm2-pkcs11-1.2.0/test/integration/test.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-get-attribute-value.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-crypt.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-get-mechanism.int.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-session-state.c Examining data/tpm2-pkcs11-1.2.0/test/integration/pkcs-login-logout.int.c Examining data/tpm2-pkcs11-1.2.0/test/unit/test_attr.c Examining data/tpm2-pkcs11-1.2.0/test/unit/test_log.c Examining data/tpm2-pkcs11-1.2.0/test/unit/test_twist.c Examining data/tpm2-pkcs11-1.2.0/test/unit/test_parser.c Examining data/tpm2-pkcs11-1.2.0/src/pkcs11.h Examining data/tpm2-pkcs11-1.2.0/src/pkcs11.c Examining data/tpm2-pkcs11-1.2.0/src/lib/session_table.h Examining data/tpm2-pkcs11-1.2.0/src/lib/attrs.h Examining data/tpm2-pkcs11-1.2.0/src/lib/mech.c Examining data/tpm2-pkcs11-1.2.0/src/lib/openssl_compat.c Examining data/tpm2-pkcs11-1.2.0/src/lib/digest.h Examining data/tpm2-pkcs11-1.2.0/src/lib/session.h Examining data/tpm2-pkcs11-1.2.0/src/lib/session.c Examining data/tpm2-pkcs11-1.2.0/src/lib/parser.c Examining data/tpm2-pkcs11-1.2.0/src/lib/key.c Examining data/tpm2-pkcs11-1.2.0/src/lib/twist.h Examining data/tpm2-pkcs11-1.2.0/src/lib/general.c Examining data/tpm2-pkcs11-1.2.0/src/lib/emitter.c Examining data/tpm2-pkcs11-1.2.0/src/lib/utils.h Examining data/tpm2-pkcs11-1.2.0/src/lib/object.h Examining data/tpm2-pkcs11-1.2.0/src/lib/encrypt.h Examining data/tpm2-pkcs11-1.2.0/src/lib/parser.h Examining data/tpm2-pkcs11-1.2.0/src/lib/checks.h Examining data/tpm2-pkcs11-1.2.0/src/lib/tpm.c Examining data/tpm2-pkcs11-1.2.0/src/lib/random.h Examining data/tpm2-pkcs11-1.2.0/src/lib/token.h Examining data/tpm2-pkcs11-1.2.0/src/lib/session_ctx.c Examining data/tpm2-pkcs11-1.2.0/src/lib/typed_memory.c Examining data/tpm2-pkcs11-1.2.0/src/lib/mutex.c Examining data/tpm2-pkcs11-1.2.0/src/lib/list.h Examining data/tpm2-pkcs11-1.2.0/src/lib/sign.c Examining data/tpm2-pkcs11-1.2.0/src/lib/random.c Examining data/tpm2-pkcs11-1.2.0/src/lib/emitter.h Examining data/tpm2-pkcs11-1.2.0/src/lib/tpm.h Examining data/tpm2-pkcs11-1.2.0/src/lib/key.h Examining data/tpm2-pkcs11-1.2.0/src/lib/encrypt.c Examining data/tpm2-pkcs11-1.2.0/src/lib/utils.c Examining data/tpm2-pkcs11-1.2.0/src/lib/mutex.h Examining data/tpm2-pkcs11-1.2.0/src/lib/mech.h Examining data/tpm2-pkcs11-1.2.0/src/lib/session_ctx.h Examining data/tpm2-pkcs11-1.2.0/src/lib/log.h Examining data/tpm2-pkcs11-1.2.0/src/lib/typed_memory.h Examining data/tpm2-pkcs11-1.2.0/src/lib/session_table.c Examining data/tpm2-pkcs11-1.2.0/src/lib/db.h Examining data/tpm2-pkcs11-1.2.0/src/lib/sign.h Examining data/tpm2-pkcs11-1.2.0/src/lib/twist.c Examining data/tpm2-pkcs11-1.2.0/src/lib/general.h Examining data/tpm2-pkcs11-1.2.0/src/lib/slot.h Examining data/tpm2-pkcs11-1.2.0/src/lib/openssl_compat.h Examining data/tpm2-pkcs11-1.2.0/src/lib/digest.c Examining data/tpm2-pkcs11-1.2.0/src/lib/object.c Examining data/tpm2-pkcs11-1.2.0/src/lib/attrs.c Examining data/tpm2-pkcs11-1.2.0/src/lib/db.c Examining data/tpm2-pkcs11-1.2.0/src/lib/slot.c Examining data/tpm2-pkcs11-1.2.0/src/lib/token.c FINAL RESULTS: data/tpm2-pkcs11-1.2.0/src/lib/log.h:93: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(stderr, fmt, argptr); data/tpm2-pkcs11-1.2.0/src/lib/db.c:988:22: [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. char *env_path = getenv(PKCS11_STORE_ENV_VAR); data/tpm2-pkcs11-1.2.0/src/lib/db.c:1010:22: [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. char *env_home = getenv("HOME"); data/tpm2-pkcs11-1.2.0/src/lib/log.h:72:19: [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. log_set_level(getenv("TPM2_PKCS11_LOG_LEVEL")); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:270:18: [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. config = getenv(TPM2_PKCS11_TCTI); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:297:21: [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. const char *c = getenv("TPM2_PKCS11_ESAPI_MANAGE_FLAGS"); data/tpm2-pkcs11-1.2.0/test/integration/pkcs-login-logout.int.c:43:26: [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. const char *config = getenv(TPM2_PKCS11_TCTI); data/tpm2-pkcs11-1.2.0/src/lib/attrs.c:85: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(newnode, buf, len); data/tpm2-pkcs11-1.2.0/src/lib/attrs.c:368: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(cpy_point, (*new_attrs)->attrs, new_len * sizeof(CK_ATTRIBUTE)); data/tpm2-pkcs11-1.2.0/src/lib/db.c:816: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 label_buf[sizeof(tok->label) + 1] = { 0 }; data/tpm2-pkcs11-1.2.0/src/lib/db.c:817: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(label_buf, tok->label, sizeof(tok->label)); data/tpm2-pkcs11-1.2.0/src/lib/db.c:1328: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 temp[PATH_MAX]; data/tpm2-pkcs11-1.2.0/src/lib/db.c:1456: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 buf[PATH_MAX]; data/tpm2-pkcs11-1.2.0/src/lib/db.c:1519:15: [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). FILE *f = fopen(lockpath, "w+"); data/tpm2-pkcs11-1.2.0/src/lib/db.c:1603: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 buf[PATH_MAX]; data/tpm2-pkcs11-1.2.0/src/lib/db.c:1636: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 lockpath[PATH_MAX]; data/tpm2-pkcs11-1.2.0/src/lib/db.c:1686: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 dbpath[PATH_MAX]; data/tpm2-pkcs11-1.2.0/src/lib/emitter.c:35: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(&s->buf[s->size], buffer, size); data/tpm2-pkcs11-1.2.0/src/lib/emitter.c:75: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 strkey[64] = { 0 }; data/tpm2-pkcs11-1.2.0/src/lib/emitter.c:116:13: [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 keyvaluebuf[64] = { 0 }; data/tpm2-pkcs11-1.2.0/src/lib/emitter.c:167:17: [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 keyvalue[64] = { 0 }; data/tpm2-pkcs11-1.2.0/src/lib/encrypt.c:240: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(ptext, buffer, rc); data/tpm2-pkcs11-1.2.0/src/lib/mech.c:872: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(hdr_buf, hdr, hdr_size); data/tpm2-pkcs11-1.2.0/src/lib/mech.c:873: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(&hdr_buf[hdr_size], inbuf, hash_len); data/tpm2-pkcs11-1.2.0/src/lib/mech.c:1008:9: [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(mechlist, tmp, supported * sizeof(mechlist[0])); data/tpm2-pkcs11-1.2.0/src/lib/mech.c:1090:13: [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(outbuf, inbuf, inlen); data/tpm2-pkcs11-1.2.0/src/lib/object.c:467:17: [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(t->pValue, found->pValue, found->ulValueLen); data/tpm2-pkcs11-1.2.0/src/lib/parser.c:341: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 key[64]; data/tpm2-pkcs11-1.2.0/src/lib/sign.c:423:9: [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(hash, opdata->buffer, datalen); data/tpm2-pkcs11-1.2.0/src/lib/token.h:58: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 label[32]; data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:181:9: [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(tpm_auth.buffer, auth, auth_len); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:608: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 manufacturerID[sizeof(UINT32)+1] = {0}; // 4 bytes + '\0' as temp storage data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:610: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(manufacturerID, (unsigned char*) &manufacturer, sizeof(uint32_t)); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:618:39: [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 *)TPM2_MANUFACTURER_MAP[i][1], data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:662:9: [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(&data[offset], rand_bytes->buffer, rand_bytes->size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:688:9: [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(stir.buffer, &seed[offset], chunk); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:871:9: [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(sig, rsassa->sig.buffer, *siglen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:887:9: [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(sig, rsapss->sig.buffer, *siglen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:934: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(sig, R->buffer, R->size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:935: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(sig + R->size, S->buffer, S->size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1003: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(tdigest.buffer, data, datalen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1057: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(rsassa->sig.buffer, sig, siglen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1079: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(R->buffer, sig, coordlen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1082: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(S->buffer, sig + coordlen, coordlen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1129: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(msgdigest.buffer, data, datalen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1300:9: [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(opdata->rsa.label.buffer, params->pSourceData, params->ulSourceDataLen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1543: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(opdata->sym.iv.buffer, mech->pParameter, mech->ulParameterLen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1647: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(tpm_ctext.buffer, ctext, ctextlen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1686: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(ptext, tpm_ptext->buffer, tpm_ptext->size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1718: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(message.buffer, pptext, pptextlen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1752: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(cctext, ctext->buffer, ctext->size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1783: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(tpm_data_in.buffer, data_in, tpm_data_in.size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1851: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(data_out, tpm_data_out->buffer, tpm_data_out->size); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1854: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(iv, tpm_iv_out, sizeof(*tpm_iv_out)); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:1928: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(new_tpm_auth.buffer, newauth, newauthlen); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:2170: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(sensitive.sensitive.data.buffer, sealdata, len); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:2179: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(sensitive.sensitive.userAuth.buffer, objauth, len); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:2859: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(&padded_data[2], mydata, len); data/tpm2-pkcs11-1.2.0/src/lib/tpm.c:2983: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(auth->buffer, newauthbin, auth->size); data/tpm2-pkcs11-1.2.0/src/lib/twist.c:114:10: [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(&hdr->data[offset], data[i].data, data[i].size); data/tpm2-pkcs11-1.2.0/src/lib/twist.c:398:9: [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. sprintf(hdr->data + (i * 2), "%02x", 255 & data[i]); data/tpm2-pkcs11-1.2.0/src/lib/typed_memory.c:69:9: [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(buf, in, len); data/tpm2-pkcs11-1.2.0/src/lib/typed_memory.c:85: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(dest, in, size + 1); data/tpm2-pkcs11-1.2.0/src/lib/utils.c:316: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 md[SHA256_DIGEST_LENGTH]; data/tpm2-pkcs11-1.2.0/src/lib/utils.h:40: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(dst, src, strnlen((char *)(src), dst_len)); data/tpm2-pkcs11-1.2.0/src/pkcs11.h:226: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:228: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:243: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:244: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:259: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:260: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:261: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:262: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:276: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:539: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:540: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:541: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/tpm2-pkcs11-1.2.0/src/pkcs11.h:993: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 cb[16]; data/tpm2-pkcs11-1.2.0/src/pkcs11.h:1035: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 iv[8]; data/tpm2-pkcs11-1.2.0/src/pkcs11.h:1041: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 iv[16]; data/tpm2-pkcs11-1.2.0/test/integration/pkcs-crypt.int.c:285: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 plaintext2[sizeof(plaintext)]; data/tpm2-pkcs11-1.2.0/test/integration/pkcs-crypt.int.c:433: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 plaintext2[sizeof(plaintext)]; data/tpm2-pkcs11-1.2.0/test/integration/pkcs-crypt.int.c:676: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(&plaintext[sizeof(plaintext) - len], secret, len); data/tpm2-pkcs11-1.2.0/test/integration/pkcs-get-attribute-value.int.c:494: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 md[SHA_DIGEST_LENGTH]; data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c:153: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(&digest_info[19], _data_hash_sha256, sizeof(_data_hash_sha256)); data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c:227: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 digest_info[19 + sizeof(_data_hash_sha256)] = { data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c:236: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(&digest_info[19], _data_hash_sha256, sizeof(_data_hash_sha256)); data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c:238: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 ckm_rsa_pkcs_sig[4096]; data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c:267: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 ckm_sha256_rsa_pkcs_sig[4096]; data/tpm2-pkcs11-1.2.0/test/integration/pkcs-sign-verify.int.c:352: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(&digest_info[19], _data_hash_sha512, sizeof(_data_hash_sha512)); data/tpm2-pkcs11-1.2.0/src/lib/parser.c:120: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). if (!value || strlen((const char *)value)) { data/tpm2-pkcs11-1.2.0/src/lib/parser.c:374: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). if (!strlen(state->key)) { data/tpm2-pkcs11-1.2.0/src/lib/twist.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). const binarybuffer things[1] = { { .size = strlen(str), .data = str } }; data/tpm2-pkcs11-1.2.0/src/lib/twist.c:239: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). size_t new_len = strlen(new_str); data/tpm2-pkcs11-1.2.0/src/lib/twist.c:285:54: [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). binarybuffer data[1] = { { .data = new_str, .size = strlen(new_str) } }; data/tpm2-pkcs11-1.2.0/src/lib/twist.c:371: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). bindata[found].size = strlen(arg); data/tpm2-pkcs11-1.2.0/src/lib/twist.c:448: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 hexlen = strlen(hexdata); data/tpm2-pkcs11-1.2.0/test/integration/pkcs-crypt.int.c:675: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(secret); data/tpm2-pkcs11-1.2.0/test/integration/pkcs-find-objects.int.c:144:38: [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). {CKA_LABEL, (void *)key_label, strlen(key_label)}, data/tpm2-pkcs11-1.2.0/test/integration/pkcs-get-attribute-value.int.c:36:38: [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). {CKA_LABEL, (void *)key_label, strlen(key_label)}, data/tpm2-pkcs11-1.2.0/test/integration/pkcs-keygen.int.c:826:61: [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). { .type = CKA_LABEL, .pValue = label, .ulValueLen = strlen((char *)label) }, data/tpm2-pkcs11-1.2.0/test/integration/pkcs-keygen.int.c:837:61: [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). { .type = CKA_LABEL, .pValue = label, .ulValueLen = strlen((char *)label) }, data/tpm2-pkcs11-1.2.0/test/unit/test_twist.c:28: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). assert_int_equal(strlen(expected), twist_len(actual)); data/tpm2-pkcs11-1.2.0/test/unit/test_twist.c:41: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). assert_int_equal(strlen(expected), twist_len(actual)); data/tpm2-pkcs11-1.2.0/test/unit/test_twist.c:65: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). assert_int_equal(strlen(expected), twist_len(actual)); data/tpm2-pkcs11-1.2.0/test/unit/test_twist.c:1035: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). assert_int_equal(strlen(raw_hex), twist_len(hex)); ANALYSIS SUMMARY: Hits = 106 Lines analyzed = 25811 in approximately 0.53 seconds (48457 lines/second) Physical Source Lines of Code (SLOC) = 17685 Hits@level = [0] 20 [1] 16 [2] 83 [3] 6 [4] 1 [5] 0 Hits@level+ = [0+] 126 [1+] 106 [2+] 90 [3+] 7 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 7.12468 [1+] 5.99378 [2+] 5.08906 [3+] 0.395816 [4+] 0.0565451 [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.