]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm_setup: Initialize pubek_len (Coverity)
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 25 May 2022 18:23:41 +0000 (14:23 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Wed, 25 May 2022 22:54:58 +0000 (18:54 -0400)
Initialize pubek_len even though it isn't necessary to do so since
it will be initialized in the first function to which it is passed.
However, Coverity complains about pubek_len passed to print_as_hex()
not being initialized, even though this is not possible.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
src/swtpm_setup/swtpm_setup.c

index 49bbaacb2f0c90aa2cdefcd2ea8367b657d0cdec..020506ceb5d23622005dbd3dbad34b71c4d27521 100644 (file)
@@ -662,7 +662,7 @@ static int init_tpm(unsigned long flags, gchar **swtpm_prg_l, const gchar *confi
     struct swtpm12 *swtpm12;
     struct swtpm *swtpm;
     g_autofree gchar *pubek = NULL;
-    size_t pubek_len;
+    size_t pubek_len = 0;
     int ret = 1;
 
     swtpm12 = swtpm12_new(swtpm_prg_l, tpm_state_path, swtpm_keyopt, gl_LOGFILE,