summaryrefslogtreecommitdiffstats
path: root/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch')
-rw-r--r--recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch105
1 files changed, 0 insertions, 105 deletions
diff --git a/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch b/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch
deleted file mode 100644
index a5af041..0000000
--- a/recipes-security/setools/setools/Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch
+++ /dev/null
@@ -1,105 +0,0 @@
1Upstream-Status: Backport [https://github.com/TresysTechnology/setools/commit/e41adf0]
2
3Signed-off-by: Kai Kang <kai.kang@windriver.com>
4
5From e41adf01647c695b80b112b337e76021bb9f30c3 Mon Sep 17 00:00:00 2001
6From: Laurent Bigonville <bigon@bigon.be>
7Date: Tue, 26 Sep 2017 15:15:30 +0200
8Subject: [PATCH] Fix build failure with GCC 7 due to possible truncation of
9 snprintf output
10
11setools fails to build under GCC7 -Wformat -Werror with the following error:
12
13x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-sign-compare -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ilibqpol -Ilibqpol/include -I/usr/include/python3.6m -c libqpol/policy_extend.c -o build/temp.linux-amd64-3.6/libqpol/policy_extend.o -Werror -Wextra -Waggregate-return -Wfloat-equal -Wformat -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-include-dirs -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wunknown-pragmas -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-qual -Wno-shadow -Wno-unreachable-code -fno-exceptions
14libqpol/policy_extend.c: In function 'policy_extend':
15libqpol/policy_extend.c:161:27: error: '%04zd' directive output may be truncated writing between 4 and 10 bytes into a region of size 5 [-Werror=format-truncation=]
16 snprintf(buff, 9, "@ttr%04zd", i + 1);
17 ^~~~~
18libqpol/policy_extend.c:161:22: note: directive argument in the range [1, 4294967295]
19 snprintf(buff, 9, "@ttr%04zd", i + 1);
20 ^~~~~~~~~~~
21
22Increase the size of the buffer to avoid collisions
23
24Closes: https://github.com/TresysTechnology/setools/issues/174
25Signed-off-by: Laurent Bigonville <bigon@bigon.be>
26---
27 libqpol/policy_extend.c | 16 ++++++++--------
28 1 file changed, 8 insertions(+), 8 deletions(-)
29
30diff --git a/libqpol/policy_extend.c b/libqpol/policy_extend.c
31index 742819b..739e184 100644
32--- a/libqpol/policy_extend.c
33+++ b/libqpol/policy_extend.c
34@@ -110,7 +110,7 @@ static int qpol_policy_remove_bogus_aliases(qpol_policy_t * policy)
35 * Builds data for the attributes and inserts them into the policydb.
36 * This function modifies the policydb. Names created for attributes
37 * are of the form @ttr<value> where value is the value of the attribute
38- * as a four digit number (prepended with 0's as needed).
39+ * as a ten digit number (prepended with 0's as needed).
40 * @param policy The policy from which to read the attribute map and
41 * create the type data for the attributes. This policy will be altered
42 * by this function.
43@@ -125,7 +125,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
44 uint32_t bit = 0, count = 0;
45 ebitmap_node_t *node = NULL;
46 type_datum_t *tmp_type = NULL, *orig_type;
47- char *tmp_name = NULL, buff[10];
48+ char *tmp_name = NULL, buff[16];
49 int error = 0, retv;
50
51 INFO(policy, "%s", "Generating attributes for policy. (Step 4 of 5)");
52@@ -137,7 +137,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
53
54 db = &policy->p->p;
55
56- memset(&buff, 0, 10 * sizeof(char));
57+ memset(&buff, 0, 16 * sizeof(char));
58
59 for (i = 0; i < db->p_types.nprim; i++) {
60 /* skip types */
61@@ -158,7 +158,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
62 * with this attribute */
63 /* Does not exist */
64 if (db->p_type_val_to_name[i] == NULL){
65- snprintf(buff, 9, "@ttr%04zd", i + 1);
66+ snprintf(buff, 15, "@ttr%010zd", i + 1);
67 tmp_name = strdup(buff);
68 if (!tmp_name) {
69 error = errno;
70@@ -240,7 +240,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
71 * Builds data for empty attributes and inserts them into the policydb.
72 * This function modifies the policydb. Names created for the attributes
73 * are of the form @ttr<value> where value is the value of the attribute
74- * as a four digit number (prepended with 0's as needed).
75+ * as a ten digit number (prepended with 0's as needed).
76 * @param policy The policy to which to add type data for attributes.
77 * This policy will be altered by this function.
78 * @return Returns 0 on success and < 0 on failure; if the call fails,
79@@ -251,7 +251,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
80 static int qpol_policy_fill_attr_holes(qpol_policy_t * policy)
81 {
82 policydb_t *db = NULL;
83- char *tmp_name = NULL, buff[10];
84+ char *tmp_name = NULL, buff[16];
85 int error = 0, retv = 0;
86 ebitmap_t tmp_bmap = { NULL, 0 };
87 type_datum_t *tmp_type = NULL;
88@@ -265,12 +265,12 @@ static int qpol_policy_fill_attr_holes(qpol_policy_t * policy)
89
90 db = &policy->p->p;
91
92- memset(&buff, 0, 10 * sizeof(char));
93+ memset(&buff, 0, 16 * sizeof(char));
94
95 for (i = 0; i < db->p_types.nprim; i++) {
96 if (db->type_val_to_struct[i])
97 continue;
98- snprintf(buff, 9, "@ttr%04zd", i + 1);
99+ snprintf(buff, 15, "@ttr%010zd", i + 1);
100 tmp_name = strdup(buff);
101 if (!tmp_name) {
102 error = errno;
103--
1042.20.1
105