Ticket #3549: acl-2.2.52-getfacl-segv.patch

File acl-2.2.52-getfacl-segv.patch, 1.7 KB (added by Miklos Karacsony, 11 years ago)
  • libacl/__acl_to_any_text.c

    Submitted By:            Miklos Karacsony <mkaracsony81 at gmail dot com>
    Date:                    2014-04-22
    Initial Package Version: 2.2.52
    Upstream Status:         Applied
    Origin:                  Upstream
    Description:             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 b acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,  
    247247                    options & TEXT_ALL_EFFECTIVE) {
    248248                        x = (options & TEXT_SMART_INDENT) ?
    249249                                ((text_p - orig_text_p)/8) : TABS-1;
     250
     251                        /* use at least one tab for indentation */
     252                        if (x > (TABS-1))
     253                                x = (TABS-1);
     254
    250255                        strncpy(text_p, tabs+x, size);
    251256                        ADVANCE(TABS-x);
    252257
  • new file test/root/getfacl.test

    diff --git a/test/root/getfacl.test b/test/root/getfacl.test
    new file mode 100644
    index 0000000..f84e25d
    - +  
     1Make sure that getfacl always adds at least one space between the permissions
     2in an acl entry and the effective permissions comment.
     3
     4        $ umask 022
     5        $ mkdir d
     6        $ groupadd loooooooooooooooooooooooonggroup
     7        $ setfacl -dm group:loooooooooooooooooooooooonggroup:rwx d
     8        $ getfacl -cde d
     9        > user::rwx
     10        > group::r-x    #effective:r-x
     11        > group:loooooooooooooooooooooooonggroup:rwx    #effective:rwx
     12        > mask::rwx
     13        > other::r-x
     14        >
     15
     16        $ groupdel loooooooooooooooooooooooonggroup
     17        $ rm -r d