mirror of
git://git.yoctoproject.org/meta-selinux
synced 2026-01-04 16:10:05 +00:00
setools: Fix build failures on 64-bit machines
Bring in a patch from https://github.com/vorlonofportland/setools, commit id 790d7a538f515d27d2390f1ef56c9871b107a346. Fixes an issue where setools fails with: error: '%04zd' directive output may be truncated writing between 4 and 10 bytes into a region of size 5 [-Werror=format-truncation=] snprintf(buff, 9, "@ttr%04zd", i + 1); Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
This commit is contained in:
parent
907e373e40
commit
d855c624f3
|
|
@ -0,0 +1,47 @@
|
|||
From 790d7a538f515d27d2390f1ef56c9871b107a346 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Langasek <steve.langasek@canonical.com>
|
||||
Date: Sun, 27 Aug 2017 21:28:40 -0700
|
||||
Subject: [PATCH] Fix build failure with GCC 7 due to possible truncation of
|
||||
snprintf output
|
||||
|
||||
setools fails to build under GCC7 -Wformat -Werror with the following error:
|
||||
|
||||
x86_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
|
||||
libqpol/policy_extend.c: In function 'policy_extend':
|
||||
libqpol/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=]
|
||||
snprintf(buff, 9, "@ttr%04zd", i + 1);
|
||||
^~~~~
|
||||
libqpol/policy_extend.c:161:22: note: directive argument in the range [1, 4294967295]
|
||||
snprintf(buff, 9, "@ttr%04zd", i + 1);
|
||||
^~~~~~~~~~~
|
||||
|
||||
Exceeding 10,000 attributes is necessarily going to result in collisions
|
||||
inserting into the hash table given this naming scheme, and we already error
|
||||
out on the first collision; but there will be holes since types are not
|
||||
handled the same as attributes. Short of making backwards-incompatible
|
||||
changes to the entry names, this is probably the best way to fix this build
|
||||
failure while reducing the chances of a hash collision in the unlikely event
|
||||
that the hashtable is (nearly) full.
|
||||
|
||||
Closes: https://github.com/TresysTechnology/setools/issues/174
|
||||
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
||||
---
|
||||
libqpol/policy_extend.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libqpol/policy_extend.c b/libqpol/policy_extend.c
|
||||
index 742819b..70e8f7c 100644
|
||||
--- a/libqpol/policy_extend.c
|
||||
+++ b/libqpol/policy_extend.c
|
||||
@@ -158,7 +158,7 @@ static int qpol_policy_build_attrs_from_map(qpol_policy_t * policy)
|
||||
* with this attribute */
|
||||
/* Does not exist */
|
||||
if (db->p_type_val_to_name[i] == NULL){
|
||||
- snprintf(buff, 9, "@ttr%04zd", i + 1);
|
||||
+ snprintf(buff, 9, "@ttr%04zd", (i + 1) % 10000);
|
||||
tmp_name = strdup(buff);
|
||||
if (!tmp_name) {
|
||||
error = errno;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
|
@ -11,6 +11,7 @@ LICENSE = "GPLv2 & LGPLv2.1"
|
|||
SRC_URI = "https://github.com/TresysTechnology/setools/archive/${PV}.tar.gz;downloadfilename=setools-${PV}.tar.gz \
|
||||
file://setools4-fixes-for-cross-compiling.patch \
|
||||
file://setools4-fix-cross-compiling-errors-for-powerpc-mips.patch \
|
||||
file://Fix-build-failure-with-GCC-7-due-to-possible-truncat.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "54cf5c0ca2aa4ef7c6ac153981af34cd"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user