diff options
author | André Draszik <andre.draszik@jci.com> | 2019-12-24 08:23:32 +0000 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2020-01-08 16:12:06 -0300 |
commit | 8b51ea3dafe9c5ac667a918911fb8f1050fc8897 (patch) | |
tree | 76093070fbfb8c78f5a1736ee9c6508f5895438d /recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch | |
parent | 241312a74438e69063fcc67d91517dc90fa96065 (diff) | |
download | meta-freescale-8b51ea3dafe9c5ac667a918911fb8f1050fc8897.tar.gz |
optee-imx: add (backported) patches for GCC 9 & musl
See the individual patches - all patches are simply
backports from optee upstream releases.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Diffstat (limited to 'recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch')
-rw-r--r-- | recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch b/recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch new file mode 100644 index 00000000..1a5c4044 --- /dev/null +++ b/recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch | |||
@@ -0,0 +1,88 @@ | |||
1 | From 7d566ed585d1e13f444d48fde5705b5be54de4af Mon Sep 17 00:00:00 2001 | ||
2 | From: Ricardo Salveti <ricardo@foundries.io> | ||
3 | Date: Wed, 26 Jun 2019 17:32:11 -0300 | ||
4 | Subject: [PATCH] regression_8100: use null terminated strings with file_to_c | ||
5 | |||
6 | GCC 9 is more strict with string manipulation, causing the build to | ||
7 | fail as the string data converted via file_to_c is not null terminated, | ||
8 | as described by the following build error: | ||
9 | |||
10 | regression_8100.c:100:29: error: '%*s' directive argument is not a | ||
11 | nul-terminated string [-Werror=format-overflow=] | ||
12 | tlen = myasprintf(&trust, "%*s", (int)sizeof(regression_8100_ca_crt), | ||
13 | ^~~ | ||
14 | regression_8100_ca_crt); | ||
15 | ~~~~~~~~~~~~~~~~~~~~~~ | ||
16 | |||
17 | Change file_to_c to terminate the string after conversion and update the | ||
18 | string size to remove the null terminated byte. Also update | ||
19 | regression_8100 to use the size variable defined via file_to_c instead | ||
20 | of manually calling sizeof. | ||
21 | |||
22 | Signed-off-by: Ricardo Salveti <ricardo@foundries.io> | ||
23 | Acked-by: Jens Wiklander <jens.wiklander@linaro.org> | ||
24 | --- | ||
25 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
26 | Upstream-Status: Backport [3.6.0] | ||
27 | host/xtest/regression_8100.c | 10 +++++----- | ||
28 | scripts/file_to_c.py | 4 ++-- | ||
29 | 2 files changed, 7 insertions(+), 7 deletions(-) | ||
30 | |||
31 | diff --git a/host/xtest/regression_8100.c b/host/xtest/regression_8100.c | ||
32 | index 04d62d9..13780e1 100644 | ||
33 | --- a/host/xtest/regression_8100.c | ||
34 | +++ b/host/xtest/regression_8100.c | ||
35 | @@ -91,13 +91,13 @@ static void test_8102(ADBG_Case_t *c) | ||
36 | return; | ||
37 | |||
38 | clen = myasprintf(&chain, "%*s\n%*s", | ||
39 | - (int)sizeof(regression_8100_my_crt), | ||
40 | + (int)regression_8100_my_crt_size, | ||
41 | regression_8100_my_crt, | ||
42 | - (int)sizeof(regression_8100_mid_crt), | ||
43 | + (int)regression_8100_mid_crt_size, | ||
44 | regression_8100_mid_crt); | ||
45 | if (!ADBG_EXPECT_COMPARE_SIGNED(c, clen, !=, -1)) | ||
46 | goto out; | ||
47 | - tlen = myasprintf(&trust, "%*s", (int)sizeof(regression_8100_ca_crt), | ||
48 | + tlen = myasprintf(&trust, "%*s", (int)regression_8100_ca_crt_size, | ||
49 | regression_8100_ca_crt); | ||
50 | if (!ADBG_EXPECT_COMPARE_SIGNED(c, tlen, !=, -1)) | ||
51 | goto out; | ||
52 | @@ -282,7 +282,7 @@ static void test_8103(ADBG_Case_t *c) | ||
53 | NULL, &ret_orig))) | ||
54 | return; | ||
55 | |||
56 | - clen = myasprintf(&csr, "%*s", (int)sizeof(regression_8100_my_csr), | ||
57 | + clen = myasprintf(&csr, "%*s", (int)regression_8100_my_csr_size, | ||
58 | regression_8100_my_csr); | ||
59 | if (!ADBG_EXPECT_COMPARE_SIGNED(c, clen, >=, 0)) | ||
60 | goto out; | ||
61 | @@ -300,7 +300,7 @@ static void test_8103(ADBG_Case_t *c) | ||
62 | if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
63 | goto out; | ||
64 | |||
65 | - myasprintf(&ca, "%*s", (int)sizeof(regression_8100_ca_crt), | ||
66 | + myasprintf(&ca, "%*s", (int)regression_8100_ca_crt_size, | ||
67 | regression_8100_ca_crt); | ||
68 | if (!ADBG_EXPECT_NOT_NULL(c, ca)) | ||
69 | goto out; | ||
70 | diff --git a/scripts/file_to_c.py b/scripts/file_to_c.py | ||
71 | index 83a9832..ae16f52 100755 | ||
72 | --- a/scripts/file_to_c.py | ||
73 | +++ b/scripts/file_to_c.py | ||
74 | @@ -37,9 +37,9 @@ def main(): | ||
75 | else: | ||
76 | f.write(" ") | ||
77 | |||
78 | - f.write("};\n") | ||
79 | + f.write("'\\0'};\n") | ||
80 | f.write("const size_t " + args.name + "_size = sizeof(" + | ||
81 | - args.name + ");\n") | ||
82 | + args.name + ") - 1;\n") | ||
83 | |||
84 | f.close() | ||
85 | inf.close() | ||
86 | -- | ||
87 | 2.23.0.rc1 | ||
88 | |||