From owner-p4-projects@FreeBSD.ORG Tue Jun 23 22:39:21 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 023971065675; Tue, 23 Jun 2009 22:39:21 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B35D21065670 for ; Tue, 23 Jun 2009 22:39:20 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id A1CE88FC1E for ; Tue, 23 Jun 2009 22:39:20 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NMdKje079846 for ; Tue, 23 Jun 2009 22:39:20 GMT (envelope-from sson@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5NMdKgP079844 for perforce@freebsd.org; Tue, 23 Jun 2009 22:39:20 GMT (envelope-from sson@FreeBSD.org) Date: Tue, 23 Jun 2009 22:39:20 GMT Message-Id: <200906232239.n5NMdKgP079844@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sson@FreeBSD.org using -f From: Stacey Son To: Perforce Change Reviews Cc: Subject: PERFORCE change 165010 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:39:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=165010 Change 165010 by sson@sson_amd64 on 2009/06/23 22:38:28 Remove trailing white space when parsing audit_control. Trailing white space can cause problems with some fields such as 'dir' in the audit_control file. Besides removing the trailing new line we remove the trail white space as well. (Credit to Brooks Davis for finding this bug.) Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#34 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#34 (text+ko) ==== @@ -27,7 +27,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#33 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#34 $ */ #include @@ -121,9 +121,13 @@ if (linestr[0] == '#') continue; - /* Remove trailing new line character. */ - if ((nl = strrchr(linestr, '\n')) != NULL) + /* Remove trailing new line character and white space. */ + nl = strchr(linestr, '\0') - 1; + while (nl >= linestr && ('\n' == *nl || ' ' == *nl || + '\t' == *nl)) { *nl = '\0'; + nl--; + } tokptr = linestr; if ((type = strtok_r(tokptr, delim, &last)) != NULL) {