fix SIGSEGV of getfacl -e on overly long group name

This commit is contained in:
Kamil Dudka 2013-11-01 13:28:26 +01:00
parent 3d993cf6de
commit 5293f396e1
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From fb071c302b8cad8837bc1e57407dc3ffa14d3f99 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 31 Oct 2013 19:24:35 +0100
Subject: [PATCH] libacl: fix SIGSEGV of getfacl -e on overly long group name
We simply make sure that at least one tab is used for indentation.
---
libacl/__acl_to_any_text.c | 5 +++++
test/root/getfacl.test | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
create mode 100644 test/root/getfacl.test
diff --git a/libacl/__acl_to_any_text.c b/libacl/__acl_to_any_text.c
index a4f9c34..1d10e81 100644
--- a/libacl/__acl_to_any_text.c
+++ b/libacl/__acl_to_any_text.c
@@ -247,6 +247,11 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,
options & TEXT_ALL_EFFECTIVE) {
x = (options & TEXT_SMART_INDENT) ?
((text_p - orig_text_p)/8) : TABS-1;
+
+ /* use at least one tab for indentation */
+ if (x > (TABS-1))
+ x = (TABS-1);
+
strncpy(text_p, tabs+x, size);
ADVANCE(TABS-x);
diff --git a/test/root/getfacl.test b/test/root/getfacl.test
new file mode 100644
index 0000000..f84e25d
--- /dev/null
+++ b/test/root/getfacl.test
@@ -0,0 +1,17 @@
+Make sure that getfacl always adds at least one space between the permissions
+in an acl entry and the effective permissions comment.
+
+ $ umask 022
+ $ mkdir d
+ $ groupadd loooooooooooooooooooooooonggroup
+ $ setfacl -dm group:loooooooooooooooooooooooonggroup:rwx d
+ $ getfacl -cde d
+ > user::rwx
+ > group::r-x #effective:r-x
+ > group:loooooooooooooooooooooooonggroup:rwx #effective:rwx
+ > mask::rwx
+ > other::r-x
+ >
+
+ $ groupdel loooooooooooooooooooooooonggroup
+ $ rm -r d
--
1.7.1

View File

@ -1,7 +1,7 @@
Summary: Access control list utilities Summary: Access control list utilities
Name: acl Name: acl
Version: 2.2.52 Version: 2.2.52
Release: 3%{?dist} Release: 4%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gawk BuildRequires: gawk
BuildRequires: gettext BuildRequires: gettext
@ -19,6 +19,9 @@ Patch3: 0003-acl-2.2.52-tests.patch
# Install the libraries to the appropriate directory # Install the libraries to the appropriate directory
Patch4: 0004-acl-2.2.52-libdir.patch Patch4: 0004-acl-2.2.52-libdir.patch
# fix SIGSEGV of getfacl -e on overly long group name
Patch5: 0005-acl-2.2.52-getfacl-segv.patch
License: GPLv2+ License: GPLv2+
Group: System Environment/Base Group: System Environment/Base
URL: http://acl.bestbits.at/ URL: http://acl.bestbits.at/
@ -56,6 +59,7 @@ defined in POSIX 1003.1e draft standard 17.
%patch1 -p1 %patch1 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
%build %build
%configure %configure
@ -117,6 +121,9 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}*
%{_libdir}/libacl.so.* %{_libdir}/libacl.so.*
%changelog %changelog
* Fri Nov 01 2013 Kamil Dudka <kdudka@redhat.com> 2.2.52-4
- fix SIGSEGV of getfacl -e on overly long group name
* Fri Aug 09 2013 Kamil Dudka <kdudka@redhat.com> 2.2.52-3 * Fri Aug 09 2013 Kamil Dudka <kdudka@redhat.com> 2.2.52-3
- drop a docdir-related patch to fix a packaging failure (#993659) - drop a docdir-related patch to fix a packaging failure (#993659)