From owner-svn-src-all@freebsd.org Wed Dec 6 10:15:36 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48882E9B746; Wed, 6 Dec 2017 10:15:36 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28D916C031; Wed, 6 Dec 2017 10:15:36 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 5C32382AF; Wed, 6 Dec 2017 10:15:35 +0000 (UTC) Date: Wed, 6 Dec 2017 10:15:35 +0000 From: Alexey Dokuchaev To: Baptiste Daroussin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326617 - head/usr.sbin/newsyslog Message-ID: <20171206101535.GA8696@FreeBSD.org> References: <201712060944.vB69iZQe027554@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201712060944.vB69iZQe027554@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 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: Wed, 06 Dec 2017 10:15:36 -0000 On Wed, Dec 06, 2017 at 09:44:35AM +0000, Baptiste Daroussin wrote: > New Revision: 326617 > URL: https://svnweb.freebsd.org/changeset/base/326617 > > Log: > Allow newsyslog to execute compression commands which > have a semantic different than the traditional gzip(1) > > This is done to allow to use zstd(1) as a compression tool without > having to patch it to change its default behavior. > > Modified: > head/usr.sbin/newsyslog/newsyslog.c > > Modified: head/usr.sbin/newsyslog/newsyslog.c > ============================================================================== > --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 06:49:53 2017 (r326616) > +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 6 09:44:35 2017 (r326617) > @@ -151,14 +151,23 @@ struct compress_types { > const char *flag; /* Flag in configuration file */ > const char *suffix; /* Compression suffix */ > const char *path; /* Path to compression program */ > + char **args; /* Comrpession arguments */ Comrpession? > + strlcpy(command, pgm_path, sizeof(command)); > + for (c = 1; args[c] != NULL; c++) { > + strlcat(command, " ", sizeof(command)); > + strlcat(command, args[c], sizeof(command)); > + } I'm wondering if we should check strlcpy/strlcat() return values here and abort early if someone is trying to overrun command buffer? ./danfe