[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Acl-devel] [PATCH] libacl: fix SIGSEGV of getfacl -e on overly long gro
From: |
Kamil Dudka |
Subject: |
[Acl-devel] [PATCH] libacl: fix SIGSEGV of getfacl -e on overly long group name |
Date: |
Thu, 31 Oct 2013 19:24:35 +0100 |
We simply make sure that at least one tab is used for indentation.
Reproducer:
# groupadd loooooooooooooooooooooooonggroup
# mkdir dir
# setfacl -dm group:loooooooooooooooooooooooonggroup:rwx dir
# getfacl -e dir
---
libacl/__acl_to_any_text.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
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);
--
1.7.1
- [Acl-devel] [PATCH] libacl: fix SIGSEGV of getfacl -e on overly long group name,
Kamil Dudka <=