[meta-freescale] [PATCH 10/14] optee-client-qoriq: GCC 8 format-truncation error

chunrong.guo at nxp.com chunrong.guo at nxp.com
Thu Jul 5 02:41:55 PDT 2018


From: Chunrong Guo <chunrong.guo at nxp.com>

*Fix the below error:
|libteec/src/teec_trace.c:110:24: error: '%s' directive output may be truncated
|writing up to 255 bytes into a region of size 246 [-Werror=format-truncation=]

Signed-off-by: Chunrong Guo <chunrong.guo at nxp.com>
---
 recipes-security/optee/optee-client-qoriq.bb       |  1 +
 .../0001-GCC-8-format-truncation-error.patch       | 35 ++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 recipes-security/optee/optee-client-qoriq/0001-GCC-8-format-truncation-error.patch

diff --git a/recipes-security/optee/optee-client-qoriq.bb b/recipes-security/optee/optee-client-qoriq.bb
index 24fa287..0a76743 100644
--- a/recipes-security/optee/optee-client-qoriq.bb
+++ b/recipes-security/optee/optee-client-qoriq.bb
@@ -8,6 +8,7 @@ inherit pythonnative systemd
 
 SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_client;nobranch=1 \
            file://0001-Respect-LDFLAGS-set-from-OE-build.patch \
+           file://0001-GCC-8-format-truncation-error.patch \
 "
 S = "${WORKDIR}/git"
 
diff --git a/recipes-security/optee/optee-client-qoriq/0001-GCC-8-format-truncation-error.patch b/recipes-security/optee/optee-client-qoriq/0001-GCC-8-format-truncation-error.patch
new file mode 100644
index 0000000..f58590c
--- /dev/null
+++ b/recipes-security/optee/optee-client-qoriq/0001-GCC-8-format-truncation-error.patch
@@ -0,0 +1,35 @@
+From 05f741c1e6263bec2977901abe61463b7f8175ad Mon Sep 17 00:00:00 2001
+From: Chunrong Guo <chunrong.guo at nxp.com>
+Date: Fri, 22 Jun 2018 11:58:09 +0800
+Subject: [PATCH] GCC 8 format-truncation error
+
+Signed-off-by: BJ DevOps Team <bjdevops at NXP1.onmicrosoft.com>
+---
+ libteec/src/teec_trace.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libteec/src/teec_trace.c b/libteec/src/teec_trace.c
+index 78b79d6..7901deb 100644
+--- a/libteec/src/teec_trace.c
++++ b/libteec/src/teec_trace.c
+@@ -73,7 +73,7 @@ int _dprintf(const char *function, int flen, int line, int level,
+ 	     const char *prefix, const char *fmt, ...)
+ {
+ 	char raw[MAX_PRINT_SIZE];
+-	char prefixed[MAX_PRINT_SIZE];
++	char prefixed[MAX_PRINT_SIZE + 10];
+ 	char *to_print = NULL;
+ 	const char *func;
+ 	int err;
+@@ -106,7 +106,7 @@ int _dprintf(const char *function, int flen, int line, int level,
+ 		 */
+ 		int thread_id = syscall(SYS_gettid);	/* perf issue ? */
+ 
+-		snprintf(prefixed, MAX_PRINT_SIZE,
++		snprintf(prefixed, MAX_PRINT_SIZE + 10,
+ 			 "%s [%d] %s:%s:%d: %s",
+ 			 trace_level_strings[level], thread_id, prefix, func,
+ 			 line, raw);
+-- 
+1.8.3.1
+
-- 
2.7.4



More information about the meta-freescale mailing list