chantra / rpms / tpm2-tss

Forked from rpms/tpm2-tss 2 years ago
Clone

Blame SOURCES/0001-tctildr-fix-segmentation-fault-if-name_conf-is-too-b.patch

b9d646
From ffca561b2de43df0a9f7f9c0e717fca943f2c38b Mon Sep 17 00:00:00 2001
b9d646
From: Johannes Holland <joh.ho@gmx.de>
b9d646
Date: Tue, 20 Aug 2019 16:58:09 +0200
b9d646
Subject: [PATCH] tctildr: fix segmentation fault if name_conf is too big
b9d646
b9d646
When strlen(name_conf) is too big and logging is set to at least DEBUG,
b9d646
tctildr_conf_parse will cause a segmentation fault. This happens when
b9d646
the unit tests are run with logging set to DEBUG. Hence, the logging
b9d646
call has to be done after the check for strlen(name_conf).
b9d646
b9d646
Signed-off-by: Johannes Holland <joh.ho@gmx.de>
b9d646
---
b9d646
 src/tss2-tcti/tctildr.c | 3 ++-
b9d646
 1 file changed, 2 insertions(+), 1 deletion(-)
b9d646
b9d646
diff --git a/src/tss2-tcti/tctildr.c b/src/tss2-tcti/tctildr.c
b9d646
index 76248f358860..ff967317b57b 100644
b9d646
--- a/src/tss2-tcti/tctildr.c
b9d646
+++ b/src/tss2-tcti/tctildr.c
b9d646
@@ -117,7 +117,6 @@ tctildr_conf_parse (const char *name_conf,
b9d646
     char *split;
b9d646
     size_t combined_length;
b9d646
 
b9d646
-    LOG_DEBUG ("name_conf: \"%s\"", name_conf);
b9d646
     if (name_conf == NULL) {
b9d646
         LOG_ERROR ("'name_conf' param may NOT be NULL");
b9d646
         return TSS2_TCTI_RC_BAD_REFERENCE;
b9d646
@@ -127,6 +126,8 @@ tctildr_conf_parse (const char *name_conf,
b9d646
         LOG_ERROR ("combined conf length must be between 0 and PATH_MAX");
b9d646
         return TSS2_TCTI_RC_BAD_VALUE;
b9d646
     }
b9d646
+
b9d646
+    LOG_DEBUG ("name_conf: \"%s\"", name_conf);
b9d646
     if (combined_length == 0)
b9d646
         return TSS2_RC_SUCCESS;
b9d646
     split = strchr (name_conf, ':');
b9d646
-- 
b9d646
2.27.0
b9d646