csomh / rpms / acl

Forked from rpms/acl 4 years ago
Clone

Blame SOURCES/acl-2.2.51-getfacl-segv.patch

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