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-tools-4.3.0/lib/efi_event.h
Examining data/tpm2-tools-4.3.0/lib/files.c
Examining data/tpm2-tools-4.3.0/lib/files.h
Examining data/tpm2-tools-4.3.0/lib/log.c
Examining data/tpm2-tools-4.3.0/lib/log.h
Examining data/tpm2-tools-4.3.0/lib/object.c
Examining data/tpm2-tools-4.3.0/lib/object.h
Examining data/tpm2-tools-4.3.0/lib/pcr.c
Examining data/tpm2-tools-4.3.0/lib/pcr.h
Examining data/tpm2-tools-4.3.0/lib/tool_rc.c
Examining data/tpm2-tools-4.3.0/lib/tool_rc.h
Examining data/tpm2-tools-4.3.0/lib/tpm2.c
Examining data/tpm2-tools-4.3.0/lib/tpm2.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_alg_util.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_alg_util.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_attr_util.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_attr_util.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_auth_util.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_auth_util.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_capability.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_capability.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_cc_util.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_cc_util.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_convert.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_convert.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_ctx_mgmt.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_ctx_mgmt.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_errata.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_errata.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_eventlog.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_eventlog.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_hash.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_hash.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_header.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_hierarchy.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_hierarchy.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_identity_util.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_kdfa.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_kdfa.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_kdfe.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_kdfe.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_nv_util.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_openssl.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_openssl.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_options.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_options.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_policy.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_policy.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_session.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_session.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_tool_output.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_tool_output.h
Examining data/tpm2-tools-4.3.0/lib/tpm2_util.c
Examining data/tpm2-tools-4.3.0/lib/tpm2_util.h
Examining data/tpm2-tools-4.3.0/test/unit/esys_stubs.h
Examining data/tpm2-tools-4.3.0/test/unit/test_cc_util.c
Examining data/tpm2-tools-4.3.0/test/unit/test_files.c
Examining data/tpm2-tools-4.3.0/test/unit/test_options.c
Examining data/tpm2-tools-4.3.0/test/unit/test_pcr.c
Examining data/tpm2-tools-4.3.0/test/unit/test_session_common.h
Examining data/tpm2-tools-4.3.0/test/unit/test_string_bytes.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_alg_util.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_attr_util.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_errata.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog_yaml.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_header.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_policy.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_session.c
Examining data/tpm2-tools-4.3.0/test/unit/test_tpm2_util.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_authorizepolicy.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_changeauth.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_createkey.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_createnv.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_createseal.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_decrypt.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_delete.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_encrypt.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_exportkey.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_exportpolicy.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_getappdata.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_getcertificate.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_getdescription.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_getinfo.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_getplatformcertificates.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_getrandom.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_gettpmblobs.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_import.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_list.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_nvextend.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_nvincrement.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_nvread.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_nvsetbits.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_nvwrite.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_pcrextend.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_pcrread.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_provision.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_quote.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_setappdata.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_setcertificate.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_setdescription.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_sign.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_template.h
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_unseal.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_verifyquote.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_verifysignature.c
Examining data/tpm2-tools-4.3.0/tools/fapi/tss2_writeauthorizenv.c
Examining data/tpm2-tools-4.3.0/tools/misc/tpm2_checkquote.c
Examining data/tpm2-tools-4.3.0/tools/misc/tpm2_eventlog.c
Examining data/tpm2-tools-4.3.0/tools/misc/tpm2_print.c
Examining data/tpm2-tools-4.3.0/tools/misc/tpm2_rc_decode.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_activatecredential.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_certify.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_certifycreation.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_changeauth.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_changeeps.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_changepps.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_clear.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_clearcontrol.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_clockrateadjust.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_create.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_createak.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_createek.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_createpolicy.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_createprimary.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_dictionarylockout.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_duplicate.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_encryptdecrypt.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_evictcontrol.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_flushcontext.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_getcap.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_getekcertificate.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_getrandom.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_gettestresult.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_gettime.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_hash.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_hierarchycontrol.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_hmac.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_import.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_incrementalselftest.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_load.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_loadexternal.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvcertify.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvdefine.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvextend.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvincrement.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvread.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvreadlock.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvreadpublic.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvsetbits.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvundefine.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvwrite.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_nvwritelock.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_pcrallocate.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_pcrevent.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_pcrextend.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_pcrread.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_pcrreset.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyauthorize.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyauthorizenv.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyauthvalue.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policycommandcode.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policycountertimer.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policycphash.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyduplicationselect.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policylocality.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policynamehash.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policynv.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policynvwritten.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyor.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policypassword.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policypcr.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyrestart.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policysecret.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policysigned.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policytemplate.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_policyticket.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_quote.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_readclock.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_readpublic.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_rsadecrypt.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_rsaencrypt.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_selftest.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_send.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_setclock.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_setprimarypolicy.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_shutdown.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_sign.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_startauthsession.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_startup.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_stirrandom.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_testparms.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_tool.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_tool.h
Examining data/tpm2-tools-4.3.0/tools/tpm2_unseal.c
Examining data/tpm2-tools-4.3.0/tools/tpm2_verifysignature.c

FINAL RESULTS:

data/tpm2-tools-4.3.0/lib/log.c:54: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-tools-4.3.0/lib/log.h:22:27:  [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.
    COMPILER_ATTR(format (printf, 4, 5));
data/tpm2-tools-4.3.0/lib/tpm2_attr_util.c:611:17:  [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.
            n = snprintf(s, left, attrs ? "%s|" : "%s", name);
data/tpm2-tools-4.3.0/lib/tpm2_attr_util.c:614:17:  [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.
            n = snprintf(s, left, attrs ? "%s=0x%X|" : "%s=0x%X", name,
data/tpm2-tools-4.3.0/lib/tpm2_options.c:77:5:  [4] (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).
    strcat(tmp_short, src->short_opts);
data/tpm2-tools-4.3.0/lib/tpm2_options.c:144:9:  [4] (shell) execlp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
        execlp("man", "man", manpage, NULL);
data/tpm2-tools-4.3.0/lib/tpm2_tool_output.h:26:13:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
            printf(fmt, ##__VA_ARGS__);         \
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:55:9:  [4] (shell) execlp:
  This causes a new program to execute and is difficult to use safely
  (CWE-78). try using a library call that implements the same functionality
  if available.
        execlp("man", "man", manpage, NULL);
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:534:4:  [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, arg);
data/tpm2-tools-4.3.0/lib/tpm2.c:3762:24:  [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.
        TPM2B_DIGEST **random) {
data/tpm2-tools-4.3.0/lib/tpm2.c:3765:30:  [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.
        ESYS_TR_NONE, count, random);
data/tpm2-tools-4.3.0/lib/tpm2.h:376:24:  [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.
        TPM2B_DIGEST **random);
data/tpm2-tools-4.3.0/lib/tpm2_openssl.c:406:17:  [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 *tmp = getenv(envvar);
data/tpm2-tools-4.3.0/lib/tpm2_options.c:257:17:  [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.
    while ((c = getopt_long(argc, argv, opts->short_opts, opts->long_opts, NULL))
data/tpm2-tools-4.3.0/lib/tpm2_util.c:675:12:  [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.
    return getenv(name);
data/tpm2-tools-4.3.0/test/unit/test_tpm2_session.c:185:24:  [3] (tmpfile) tmpnam:
  Temporary file race condition (CWE-377).
    int rc = (*state = tmpnam(NULL)) == NULL;
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:99:17:  [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.
    while ((c = getopt_long (argc, argv, (*tool_opts)->short_opts,
data/tpm2-tools-4.3.0/lib/files.c:116: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(path, "rb");
data/tpm2-tools-4.3.0/lib/files.c:138:23:  [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 *fp = path ? fopen(path, "wb+") : stdout;
data/tpm2-tools-4.3.0/lib/files.c:236: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(path, "w+b");
data/tpm2-tools-4.3.0/lib/files.c:411: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(path, "rb");
data/tpm2-tools-4.3.0/lib/files.c:431:16:  [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 *fp = fopen(path, "rb");
data/tpm2-tools-4.3.0/lib/files.c:455:16:  [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 *fp = fopen(path, "rb");
data/tpm2-tools-4.3.0/lib/files.c:637: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(buf, input_buffer, input_buffer_size);
data/tpm2-tools-4.3.0/lib/object.c:45: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(objectstr, "rb");
data/tpm2-tools-4.3.0/lib/pcr.c:36: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[4];
data/tpm2-tools-4.3.0/lib/pcr.c:88: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[9];
data/tpm2-tools-4.3.0/lib/tpm2.c:4111: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(to_hash, command_code, sizeof(command_code));
data/tpm2-tools-4.3.0/lib/tpm2.c:4116: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(to_hash + offset, name1->name, name1->size);
data/tpm2-tools-4.3.0/lib/tpm2.c:4120: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(to_hash + offset, name2->name, name2->size);
data/tpm2-tools-4.3.0/lib/tpm2.c:4124: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(to_hash + offset, name3->name, name3->size);
data/tpm2-tools-4.3.0/lib/tpm2.c:4129: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(to_hash + offset, command_parameters, command_parameters_size);
data/tpm2-tools-4.3.0/lib/tpm2_alg_util.c:166: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[256];
data/tpm2-tools-4.3.0/lib/tpm2_alg_util.c:502: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[256];
data/tpm2-tools-4.3.0/lib/tpm2_auth_util.c:124: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[PATH_MAX];
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:49: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 errstr[256] = { 0 };
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:251:16:  [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 *fp = fopen(path, "wb");
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:346: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, r->data, r->length);
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:359: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, s->data, s->length);
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:479: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(buffer, signature->signature.rsassa.sig.buffer, *size);
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:487: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(buffer, signature->signature.rsapss.sig.buffer, *size);
data/tpm2-tools-4.3.0/lib/tpm2_convert.c:501: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(buffer, hmac_sig, *size);
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:88: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(&dest[j], "%02x", buf[i]);
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:108: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 hexstr[DIGEST_HEX_STRING_MAX] = { 0, };
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:173: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 uuidstr[37] = { 0 };
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:201: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[50] = { '\0', };
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:203: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 (buf, action, size);
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:234: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 hexstr[EVENT_BUF_MAX] = { 0, };
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:299: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 digest_hex[41] = { '\0', };
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:314: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 sig_str[sizeof(specid->Signature) + 1] = { '\0', };
data/tpm2-tools-4.3.0/lib/tpm2_eventlog_yaml.c:315: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_str, specid->Signature, sizeof(specid->Signature));
data/tpm2-tools-4.3.0/lib/tpm2_hash.c:39: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(buffer.buffer, inbuffer, buffer.size);
data/tpm2-tools-4.3.0/lib/tpm2_hash.c:73: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(buffer.buffer, inbuffer, buffer.size);
data/tpm2-tools-4.3.0/lib/tpm2_hash.c:104: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(buffer.buffer, inbuffer, buffer.size);
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:28: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 *dbmask, seedmask[EVP_MAX_MD_SIZE];
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:58: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(db + emlen - flen - mdlen, from, (unsigned int)flen);
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:117: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(pub_modulus, pub_key_val->buffer, mod_size);
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:134: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 encoded[TPM2_MAX_DIGEST_BUFFER];
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:285:20:  [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 unsigned char iv[512] = { 0 };
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:350: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(to_hmac_buffer, buffer1, buffer1_size);
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:351: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(to_hmac_buffer + buffer1_size, buffer2, buffer2_size);
data/tpm2-tools-4.3.0/lib/tpm2_identity_util.c:379: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(buffer_marshalled_sensitiveArea + marshalled_sensitive_size +
data/tpm2-tools-4.3.0/lib/tpm2_kdfe.c:32: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(use.buffer, label, label_length);
data/tpm2-tools-4.3.0/lib/tpm2_kdfe.c:49: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_input.buffer, &counter_be, 4);
data/tpm2-tools-4.3.0/lib/tpm2_nv_util.h:192: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_buffer + data_offset, nv_data->buffer, nv_data->size);
data/tpm2-tools-4.3.0/lib/tpm2_openssl.c:461: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(path, "rb");
data/tpm2-tools-4.3.0/lib/tpm2_openssl.c:921: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(path, "rb");
data/tpm2-tools-4.3.0/lib/tpm2_openssl.c:1107: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(path, "r");
data/tpm2-tools-4.3.0/lib/tpm2_options.c:60: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(opts->long_opts, long_opts, len * sizeof(*long_opts));
data/tpm2-tools-4.3.0/lib/tpm2_options.c:97: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(&d->long_opts[d->len], src->long_opts,
data/tpm2-tools-4.3.0/lib/tpm2_options.c:134:22:  [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).
            int fd = open("/dev/null", O_WRONLY);
data/tpm2-tools-4.3.0/lib/tpm2_policy.c:100:20:  [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 *fp = fopen(raw_pcrs_file, "rb");
data/tpm2-tools-4.3.0/lib/tpm2_policy.c:134: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(pcr_values.digests[i].buffer, pcr_val->digests[i].buffer,
data/tpm2-tools-4.3.0/lib/tpm2_policy.c:425: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(raw_data, nonce_tpm->buffer, nonce_tpm->size);
data/tpm2-tools-4.3.0/lib/tpm2_policy.c:430: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(raw_data + offset, (UINT8 *)&endswap_data, sizeof(INT32));
data/tpm2-tools-4.3.0/lib/tpm2_policy.c:433: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(raw_data + offset, policy_qualifier.buffer,
data/tpm2-tools-4.3.0/lib/tpm2_session.c:68: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(&session->input->auth_data, auth, sizeof(*auth));
data/tpm2-tools-4.3.0/lib/tpm2_session.c:240: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(dup_path, "rb");
data/tpm2-tools-4.3.0/lib/tpm2_session.c:357:24:  [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).
        session_file = fopen(path, "w+b");
data/tpm2-tools-4.3.0/lib/tpm2_util.c:56: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(&result->buffer[result->size], append->buffer, append->size);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:205: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 tmp_str[4] = { 0 };
data/tpm2-tools-4.3.0/lib/tpm2_util.c:217: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(input, "rb");
data/tpm2-tools-4.3.0/lib/tpm2_util.c:604: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(buf.buffer, seed->buffer, seed->size);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:605: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(&buf.buffer[seed->size], key->buffer, key->size);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:859: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 msg[256] = { 0 };
data/tpm2-tools-4.3.0/lib/tpm2_util.c:861: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 print_flags[32] = { '[', '\0' };
data/tpm2-tools-4.3.0/lib/tpm2_util.c:929: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(value, "rb");
data/tpm2-tools-4.3.0/lib/tpm2_util.c:963: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->buffer, value, len);
data/tpm2-tools-4.3.0/test/unit/esys_stubs.h:44: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(&handles[0], &rev[0], sizeof(rev));
data/tpm2-tools-4.3.0/test/unit/test_files.c:33:16:  [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).
    tf->file = fopen(tf->path, "w+b");
data/tpm2-tools-4.3.0/test/unit/test_tpm2_alg_util.c:26: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 str_value[256]; \
data/tpm2-tools-4.3.0/test/unit/test_tpm2_alg_util.c:97: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[256];
data/tpm2-tools-4.3.0/test/unit/test_tpm2_alg_util.c:148: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 *optstr[1] = { \
data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.c:108: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(ptr, mocked_file_data, size * nmemb);
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:67: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[TCG_DIGEST2_SHA1_SIZE];
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:102: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[sizeof(TCG_EVENT_HEADER2) - 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:111: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE - 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:124: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2) - 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:137: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:158: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2) + 6] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:177: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2) + 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:193: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2) + 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:212: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2) + 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:231: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[sizeof(TCG_EVENT_HEADER2) + TCG_DIGEST2_SHA1_SIZE + sizeof(TCG_EVENT2) + 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:261: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[sizeof(TCG_EVENT2) + sizeof(UEFI_VARIABLE_DATA) + sizeof(char16_t)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:273: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[sizeof(TCG_EVENT2)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:329: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[sizeof(*event) + sizeof(*event_specid)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:344: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[sizeof(*event) + 1] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:358: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[sizeof(*event) + sizeof(*event_specid)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:373: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[sizeof(*event) + sizeof(*event_specid)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:391: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[sizeof(*event) + sizeof(*event_specid) + sizeof(*alg)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:410: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[sizeof(*event) + sizeof(*event_specid) + sizeof(*alg) + sizeof(*vendor)] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_eventlog.c:432: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[sizeof(*event) + sizeof(*event_specid) + sizeof(*alg) + sizeof(*vendor) + 5] = { 0, };
data/tpm2-tools-4.3.0/test/unit/test_tpm2_policy.c:206:16:  [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).
    tf->file = fopen(tf->path, "w+b");
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:45:22:  [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).
            int fd = open("/dev/null", O_WRONLY);
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:397:18:  [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).
    int fileno = open (path, oflags, S_IWUSR | S_IRUSR);
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:449:18:  [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).
    int fileno = open (path, O_RDONLY);
data/tpm2-tools-4.3.0/tools/misc/tpm2_checkquote.c:56:26:  [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 *pubkey_input = fopen(ctx.pubkey_file_path, "rb");
data/tpm2-tools-4.3.0/tools/misc/tpm2_checkquote.c:161:23:  [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 *pcr_input = fopen(pcr_file_path, "rb");
data/tpm2-tools-4.3.0/tools/misc/tpm2_print.c:387:14:  [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).
        fd = fopen(ctx.file.path, "rb");
data/tpm2-tools-4.3.0/tools/tpm2_activatecredential.c:47:16:  [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 *fp = fopen(path, "rb");
data/tpm2-tools-4.3.0/tools/tpm2_createek.c:157: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(&input_public->publicArea.unique.rsa.buffer, &nonce, nonce_size);
data/tpm2-tools-4.3.0/tools/tpm2_createek.c:161: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(&input_public->publicArea.unique.ecc.x.buffer, &nonce, nonce_size);
data/tpm2-tools-4.3.0/tools/tpm2_encryptdecrypt.c:147:33:  [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).
            ctx.out_file_path ? fopen(ctx.out_file_path, "wb+") : stdout;
data/tpm2-tools-4.3.0/tools/tpm2_encryptdecrypt.c:169: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(in_data.buffer, ctx.input_data, in_data.size);
data/tpm2-tools-4.3.0/tools/tpm2_encryptdecrypt.c:198: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(in_data.buffer, &ctx.input_data[data_offset], in_data.size);
data/tpm2-tools-4.3.0/tools/tpm2_getcap.c:189: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.
    static char buf[5];
data/tpm2-tools-4.3.0/tools/tpm2_getcap.c:218: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(buf, bytes, j);
data/tpm2-tools-4.3.0/tools/tpm2_getcap.c:623:16:  [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[16];
data/tpm2-tools-4.3.0/tools/tpm2_getekcertificate.c:391:35:  [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).
        ctx.ec_cert_file_handle = fopen(ctx.ec_cert_path, "wb");
data/tpm2-tools-4.3.0/tools/tpm2_getrandom.c:52: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).
        out = fopen(ctx.output_file, "wb+");
data/tpm2-tools-4.3.0/tools/tpm2_hash.c:54: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).
        out = fopen(ctx.output_hash_path, "wb+");
data/tpm2-tools-4.3.0/tools/tpm2_hash.c:95:22:  [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).
    ctx.input_file = fopen(argv[0], "rb");
data/tpm2-tools-4.3.0/tools/tpm2_hmac.c:181: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).
        out = fopen(ctx.hmac_output_file_path, "wb+");
data/tpm2-tools-4.3.0/tools/tpm2_hmac.c:254:17:  [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).
    ctx.input = fopen(argv[0], "rb");
data/tpm2-tools-4.3.0/tools/tpm2_import.c:128: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(private->buffer + hmac_size_offset, outer_hmac->buffer,
data/tpm2-tools-4.3.0/tools/tpm2_import.c:130: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(private->buffer + hmac_size_offset + parent_hash_size,
data/tpm2-tools-4.3.0/tools/tpm2_import.c:485: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[10] = { 'D', 'U', 'P', 'L', 'I', 'C', 'A', 'T', 'E', 0 };
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:42:16:  [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 *fp = fopen(path, "wb+");
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:98: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[10] = { 'I', 'D', 'E', 'N', 'T', 'I', 'T', 'Y', 0 };
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:125: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(marshalled_inner_integrity.buffer, &cred_size, sizeof(cred_size));
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:126: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(&marshalled_inner_integrity.buffer[2], ctx.credential.buffer,
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:151: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(cred_blob.credential + offset, &outer_hmac_size,
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:154: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(cred_blob.credential + offset, outer_hmac.buffer, outer_hmac.size);
data/tpm2-tools-4.3.0/tools/tpm2_makecredential.c:157: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(cred_blob.credential + offset, encrypted_sensitive.buffer,
data/tpm2-tools-4.3.0/tools/tpm2_nvwrite.c:75: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(nv_write_data.buffer, &ctx.nv_buffer, ctx.data_size);
data/tpm2-tools-4.3.0/tools/tpm2_nvwrite.c:111: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(nv_write_data.buffer, &ctx.nv_buffer[data_offset],
data/tpm2-tools-4.3.0/tools/tpm2_pcrevent.c:198:19:  [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 *x = fopen(argv[i], "rb");
data/tpm2-tools-4.3.0/tools/tpm2_pcrread.c:158:27:  [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).
        ctx.output_file = fopen(ctx.output_file_path, "wb+");
data/tpm2-tools-4.3.0/tools/tpm2_quote.c:299:26:  [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).
        ctx.pcr_output = fopen(ctx.pcr_path, "wb+");
data/tpm2-tools-4.3.0/tools/tpm2_rsadecrypt.c:60:36:  [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).
            ctx.output_file_path ? fopen(ctx.output_file_path, "wb+") : stdout;
data/tpm2-tools-4.3.0/tools/tpm2_rsaencrypt.c:40:33:  [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 = ctx.output_path ? fopen(ctx.output_path, "wb+") : stdout;
data/tpm2-tools-4.3.0/tools/tpm2_send.c:52: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(command, buffer, sizeof(buffer));
data/tpm2-tools-4.3.0/tools/tpm2_send.c:85: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(path, mode);
data/tpm2-tools-4.3.0/tools/tpm2_send.c:121:17:  [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).
    ctx.input = fopen(argv[0], "rb");
data/tpm2-tools-4.3.0/tools/tpm2_sign.c:136:40:  [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 *input = ctx.input_file ? fopen(ctx.input_file, "rb") : stdin;
data/tpm2-tools-4.3.0/tools/tpm2_testparms.c:87: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(&ctx.inputalg.parameters, &algorithm.publicArea.parameters,
data/tpm2-tools-4.3.0/lib/files.c:627: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).
        size_t input_buffer_size = strlen(input_buffer);
data/tpm2-tools-4.3.0/lib/pcr.c:41: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 (str == NULL || len == 0 || strlen(str) == 0) {
data/tpm2-tools-4.3.0/lib/pcr.c:90: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 (str == NULL || len == 0 || strlen(str) == 0)
data/tpm2-tools-4.3.0/lib/pcr.c:291: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).
            current_length = strlen(current_string);
data/tpm2-tools-4.3.0/lib/tpm2_alg_util.c:289:24:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    size_t len = ext ? strlen(ext) : 0;
data/tpm2-tools-4.3.0/lib/tpm2_alg_util.c:319:24:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    size_t len = ext ? strlen(ext) : 0;
data/tpm2-tools-4.3.0/lib/tpm2_attr_util.c:388:24:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    size_t match_len = strlen(token);
data/tpm2-tools-4.3.0/lib/tpm2_attr_util.c:559: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).
        size_t name_len = strlen(d->name);
data/tpm2-tools-4.3.0/lib/tpm2_auth_util.c:320:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (read < 0) {
data/tpm2-tools-4.3.0/lib/tpm2_auth_util.c:327:38:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        if (rc != tool_rc_success || read < 0) {
data/tpm2-tools-4.3.0/lib/tpm2_options.c:70: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 opts_len = strlen(d->short_opts) + strlen(src->short_opts) + 1;
data/tpm2-tools-4.3.0/lib/tpm2_options.c:70: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).
    size_t opts_len = strlen(d->short_opts) + strlen(src->short_opts) + 1;
data/tpm2-tools-4.3.0/lib/tpm2_util.c:191: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).
    str_length = strlen(input_string);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:824:42:  [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).
    bool is_o = !strncmp(value, "owner", strlen(value));
data/tpm2-tools-4.3.0/lib/tpm2_util.c:829: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).
    bool is_p = !strncmp(value, "platform", strlen(value));
data/tpm2-tools-4.3.0/lib/tpm2_util.c:834:48:  [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).
    bool is_e = !strncmp(value, "endorsement", strlen(value));
data/tpm2-tools-4.3.0/lib/tpm2_util.c:839: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).
    bool is_n = !strncmp(value, "null", strlen(value));
data/tpm2-tools-4.3.0/lib/tpm2_util.c:844: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).
    bool is_l = !strncmp(value, "lockout", strlen(value));
data/tpm2-tools-4.3.0/lib/tpm2_util.c:864:13:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant string.
            strncat(print_flags, "o|",
data/tpm2-tools-4.3.0/lib/tpm2_util.c:865: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).
                    sizeof(print_flags) - strlen(print_flags) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:869:13:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant string.
            strncat(print_flags, "p|",
data/tpm2-tools-4.3.0/lib/tpm2_util.c:870: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).
                    sizeof(print_flags) - strlen(print_flags) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:874:13:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant string.
            strncat(print_flags, "e|",
data/tpm2-tools-4.3.0/lib/tpm2_util.c:875: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).
                    sizeof(print_flags) - strlen(print_flags) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:879:13:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant string.
            strncat(print_flags, "n|",
data/tpm2-tools-4.3.0/lib/tpm2_util.c:880: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).
                    sizeof(print_flags) - strlen(print_flags) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:884:13:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant string.
            strncat(print_flags, "l|",
data/tpm2-tools-4.3.0/lib/tpm2_util.c:885: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).
                    sizeof(print_flags) - strlen(print_flags) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:888: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).
        size_t len = strlen(print_flags);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:894:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant character.
        strncat(print_flags, "]",
data/tpm2-tools-4.3.0/lib/tpm2_util.c:895:39:  [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).
                sizeof(print_flags) - strlen(print_flags) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:904:9:  [1] (buffer) strncat:
  Easily used incorrectly (e.g., incorrectly computing the correct maximum
  size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf,
  or automatically resizing strings. Risk is low because the source is a
  constant string.
        strncat(msg, "a handle number", sizeof(msg) - strlen(msg) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:904:55:  [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).
        strncat(msg, "a handle number", sizeof(msg) - strlen(msg) - 1);
data/tpm2-tools-4.3.0/lib/tpm2_util.c:956: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(value);
data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.c:143:40:  [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).
    will_return(__wrap_fread, (size_t) strlen(mocked_file_data));
data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.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).
    will_return(__wrap_ftell, (long) strlen(mocked_file_data));
data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.c:145: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).
    will_return(__wrap_ftell, (long) strlen(mocked_file_data));
data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.c:153: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).
    assert_int_equal(auth->size, strlen(mocked_file_data));
data/tpm2-tools-4.3.0/test/unit/test_tpm2_auth_util.c:154: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).
    assert_memory_equal(auth->buffer, mocked_file_data, strlen(mocked_file_data));
data/tpm2-tools-4.3.0/tools/fapi/tss2_exportkey.c:74: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(exportedData));
data/tpm2-tools-4.3.0/tools/fapi/tss2_exportpolicy.c:69: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(jsonPolicy));
data/tpm2-tools-4.3.0/tools/fapi/tss2_getcertificate.c:68: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(x509certData));
data/tpm2-tools-4.3.0/tools/fapi/tss2_getdescription.c:68: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(description));
data/tpm2-tools-4.3.0/tools/fapi/tss2_getinfo.c:59:62:  [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 = open_write_and_close (ctx.info, ctx.overwrite, info, strlen(info));
data/tpm2-tools-4.3.0/tools/fapi/tss2_gettpmblobs.c:112: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(policy));
data/tpm2-tools-4.3.0/tools/fapi/tss2_list.c:55: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(pathList));
data/tpm2-tools-4.3.0/tools/fapi/tss2_nvread.c:94: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(logData));
data/tpm2-tools-4.3.0/tools/fapi/tss2_pcrread.c:98: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(pcrLog));
data/tpm2-tools-4.3.0/tools/fapi/tss2_quote.c:176: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(quoteInfo));
data/tpm2-tools-4.3.0/tools/fapi/tss2_quote.c:191: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(pcrLog));
data/tpm2-tools-4.3.0/tools/fapi/tss2_quote.c:216: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(certificate));
data/tpm2-tools-4.3.0/tools/fapi/tss2_setdescription.c:20: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).
        if (value && strlen (value) > 1023) {
data/tpm2-tools-4.3.0/tools/fapi/tss2_sign.c:117: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).
    if (ctx.certificate && certificate && strlen(certificate)) {
data/tpm2-tools-4.3.0/tools/fapi/tss2_sign.c:119: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).
                certificate, strlen(certificate));
data/tpm2-tools-4.3.0/tools/fapi/tss2_sign.c:144: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).
                strlen(publicKey));
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:137: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).
                t = t + strlen("\"version\"");
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:140: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).
                if (ret!=1 || strlen(version) > 128 ) {
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:288:20:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            while (getchar () != '\n'); /* Consume all remainign input */
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:433:29:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        while ((data_read = read (STDIN_FILENO, *input + data_consumed, 1024))){
data/tpm2-tools-4.3.0/tools/fapi/tss2_template.c:470:15:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if (-1 == read (fileno, *input, stat_.st_size)) {
data/tpm2-tools-4.3.0/tools/tpm2_clockrateadjust.c:32: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(adjustment);
data/tpm2-tools-4.3.0/tools/tpm2_getekcertificate.c:176: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).
    size_t len = 1 + strlen(b64h) + strlen(ctx.ek_server_addr);
data/tpm2-tools-4.3.0/tools/tpm2_getekcertificate.c:176: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).
    size_t len = 1 + strlen(b64h) + strlen(ctx.ek_server_addr);

ANALYSIS SUMMARY:

Hits = 220
Lines analyzed = 44894 in approximately 0.95 seconds (47371 lines/second)
Physical Source Lines of Code (SLOC) = 32419
Hits@level = [0] 155 [1]  63 [2] 140 [3]   8 [4]   9 [5]   0
Hits@level+ = [0+] 375 [1+] 220 [2+] 157 [3+]  17 [4+]   9 [5+]   0
Hits/KSLOC@level+ = [0+] 11.5673 [1+] 6.78614 [2+] 4.84284 [3+] 0.524384 [4+] 0.277615 [5+]   0
Dot directories skipped = 2 (--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.