From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13035 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Possible oversight in setvbuf() Date: Fri, 13 Jul 2018 17:31:10 -0400 Message-ID: <20180713213110.GD1392@brightrain.aerifal.cx> References: <20180713144052.GA13099@voyager> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1531517362 20599 195.159.176.226 (13 Jul 2018 21:29:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 13 Jul 2018 21:29:22 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-13051-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jul 13 23:29:18 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fe5cr-0005G0-62 for gllmg-musl@m.gmane.org; Fri, 13 Jul 2018 23:29:17 +0200 Original-Received: (qmail 27924 invoked by uid 550); 13 Jul 2018 21:31:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 27905 invoked from network); 13 Jul 2018 21:31:22 -0000 Content-Disposition: inline In-Reply-To: <20180713144052.GA13099@voyager> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:13035 Archived-At: On Fri, Jul 13, 2018 at 04:40:52PM +0200, Markus Wichmann wrote: > Hi all, > > ungetc() seems to depend on f->buf pointing UNGET bytes into a valid > array. fdopen() will provide such a thing. However, setvbuf() will set > f->buf to the very start of the user provided buffer. Bizarrely, UNGET > is deducted from the buffer size, but not added to the pointer. > Oversight or intentional? Definitely a bug -- thanks for catching this. I guess it's a good thing that the release has been delayed for a while, so it won't be in the wild except where musl git master is in use rather than a release. One thing this highlights is that we could really use better testing and security review process. I'll write and submit a test to libc-test for this, but I'd really like if it we could find someone using musl willing to sponsor continuous or periodic security reviews of changes by a third party. Rich