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

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