From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 5 15:01:57 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0552D106566B; Sat, 5 Sep 2009 15:01:57 +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 CD3998FC08; Sat, 5 Sep 2009 15:01:56 +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 n85F1umf056567; Sat, 5 Sep 2009 15:01:56 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n85F1upm056564; Sat, 5 Sep 2009 15:01:56 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909051501.n85F1upm056564@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 5 Sep 2009 15:01:56 +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: r196862 - in stable/8/lib/libc: . posix1e stdio stdtime string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Sep 2009 15:01:57 -0000 Author: trasz Date: Sat Sep 5 15:01:56 2009 New Revision: 196862 URL: http://svn.freebsd.org/changeset/base/196862 Log: MFC r196740: Fix regression introduced with NFSv4 ACL support - make acl_to_text(3) and acl_calc_mask(3) return error instead of crashing when acl passed to them is NULL. Submitted by: markus Reviewed by: rwatson Approved by: re (kib) Modified: stable/8/lib/libc/ (props changed) stable/8/lib/libc/posix1e/acl_calc_mask.c stable/8/lib/libc/posix1e/acl_to_text.c stable/8/lib/libc/stdio/asprintf.c (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/string/ffsll.c (props changed) stable/8/lib/libc/string/flsll.c (props changed) stable/8/lib/libc/string/wcpcpy.c (props changed) stable/8/lib/libc/string/wcpncpy.c (props changed) Modified: stable/8/lib/libc/posix1e/acl_calc_mask.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_calc_mask.c Sat Sep 5 13:32:05 2009 (r196861) +++ stable/8/lib/libc/posix1e/acl_calc_mask.c Sat Sep 5 15:01:56 2009 (r196862) @@ -50,12 +50,6 @@ acl_calc_mask(acl_t *acl_p) acl_t acl_new; int i, mask_mode, mask_num; - if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { - errno = EINVAL; - return (-1); - } - _acl_brand_as(*acl_p, ACL_BRAND_POSIX); - /* * (23.4.2.4) requires acl_p to point to a pointer to a valid ACL. * Since one of the primary reasons to use this function would be @@ -67,6 +61,13 @@ acl_calc_mask(acl_t *acl_p) errno = EINVAL; return (-1); } + + if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { + errno = EINVAL; + return (-1); + } + _acl_brand_as(*acl_p, ACL_BRAND_POSIX); + acl_int = &(*acl_p)->ats_acl; if ((acl_int->acl_cnt < 3) || (acl_int->acl_cnt > ACL_MAX_ENTRIES)) { errno = EINVAL; Modified: stable/8/lib/libc/posix1e/acl_to_text.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_to_text.c Sat Sep 5 13:32:05 2009 (r196861) +++ stable/8/lib/libc/posix1e/acl_to_text.c Sat Sep 5 15:01:56 2009 (r196862) @@ -70,11 +70,6 @@ _posix1e_acl_to_text(acl_t acl, ssize_t if (buf == NULL) return(NULL); - if (acl == NULL) { - errno = EINVAL; - return(NULL); - } - acl_int = &acl->ats_acl; mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */ @@ -243,6 +238,11 @@ char * acl_to_text_np(acl_t acl, ssize_t *len_p, int flags) { + if (acl == NULL) { + errno = EINVAL; + return(NULL); + } + switch (_acl_brand(acl)) { case ACL_BRAND_POSIX: return (_posix1e_acl_to_text(acl, len_p, flags));