From owner-svn-src-all@FreeBSD.ORG Tue Apr 13 06:01:25 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 671AB1065670; Tue, 13 Apr 2010 06:01:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54CBB8FC0A; Tue, 13 Apr 2010 06:01:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3D61PCH060992; Tue, 13 Apr 2010 06:01:25 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3D61PYS060991; Tue, 13 Apr 2010 06:01:25 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201004130601.o3D61PYS060991@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 13 Apr 2010 06:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206542 - stable/8/lib/libc/posix1e X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2010 06:01:25 -0000 Author: trasz Date: Tue Apr 13 06:01:24 2010 New Revision: 206542 URL: http://svn.freebsd.org/changeset/base/206542 Log: MFC r205796: Make acl_to_text_np(3) not crash on long group or user names in NFSv4 ACLs. PR: amd64/145091 Modified: stable/8/lib/libc/posix1e/acl_to_text_nfs4.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/posix1e/acl_to_text_nfs4.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_to_text_nfs4.c Tue Apr 13 03:10:38 2010 (r206541) +++ stable/8/lib/libc/posix1e/acl_to_text_nfs4.c Tue Apr 13 06:01:24 2010 (r206542) @@ -167,7 +167,7 @@ format_additional_id(char *str, size_t s static int format_entry(char *str, size_t size, const acl_entry_t entry, int flags) { - size_t off = 0, padding_length, maximum_who_field_length = 18; + size_t off = 0, min_who_field_length = 18; acl_permset_t permset; acl_flagset_t flagset; int error, len; @@ -188,12 +188,9 @@ format_entry(char *str, size_t size, con if (error) return (error); len = strlen(buf); - padding_length = maximum_who_field_length - len; - if (padding_length > 0) { - memset(str, ' ', padding_length); - off += padding_length; - } - off += snprintf(str + off, size - off, "%s:", buf); + if (len < min_who_field_length) + len = min_who_field_length; + off += snprintf(str + off, size - off, "%*s:", len, buf); error = _nfs4_format_access_mask(buf, sizeof(buf), *permset, flags & ACL_TEXT_VERBOSE);