Hi there,

I am wandering around some old bugs and there is one report from coverity from some years ago, that was still not fixed and is also applicable to upstrem. The problem is in funcition get_srk_info in file

    usr/lib/pkcs11/tpm_stdll/tpm_util.c

There is variable secret_h, which is allocated and when there is failure on line 319, the memory is not correctly freed. Adding the free into failed branch of this condition solves the problem (see attached patch)

Best regards,

--
Jakub Jelen
Security Technologies
Red Hat

diff --git a/usr/lib/pkcs11/tpm_stdll/tpm_util.c b/usr/lib/pkcs11/tpm_stdll/tpm_util.c
index 768ad67..e1b917b 100644
--- a/usr/lib/pkcs11/tpm_stdll/tpm_util.c
+++ b/usr/lib/pkcs11/tpm_stdll/tpm_util.c
@@ -317,6 +317,7 @@ get_srk_info(struct srk_info *srk)
 		 * represent the hash.
 		 */
 		if (srk->len != (h_len * 2)) {
+			free(secret_h);
 			TRACE_DEVEL("Hashed secret is %d bytes, expected %d.\n",
 				     srk->len, h_len*2);
 			goto error;
------------------------------------------------------------------------------
_______________________________________________
Opencryptoki-tech mailing list
Opencryptoki-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to