From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7565 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Return rv if memory is not 'calloc'ed in getgrent_a Date: Fri, 1 May 2015 11:50:10 -0400 Message-ID: <20150501155010.GA17573@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1430495430 25463 80.91.229.3 (1 May 2015 15:50:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 May 2015 15:50:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7578-gllmg-musl=m.gmane.org@lists.openwall.com Fri May 01 17:50:26 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YoDCr-0003a6-3R for gllmg-musl@m.gmane.org; Fri, 01 May 2015 17:50:25 +0200 Original-Received: (qmail 28525 invoked by uid 550); 1 May 2015 15:50:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28507 invoked from network); 1 May 2015 15:50:22 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7565 Archived-At: On Fri, May 01, 2015 at 05:17:37AM -0700, Kevin Bowling wrote: > >From 714875b1a614c4ac3b7a04a9d419b7f57d28e336 Mon Sep 17 00:00:00 2001 > From: Kevin Bowling > Date: Fri, 1 May 2015 05:11:12 -0700 > Subject: [PATCH] Return rv if memory is not 'calloc'ed in getgrent_a > > --- > src/passwd/getgrent_a.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/passwd/getgrent_a.c b/src/passwd/getgrent_a.c > index ecd2f2e..80fbc42 100644 > --- a/src/passwd/getgrent_a.c > +++ b/src/passwd/getgrent_a.c > @@ -48,7 +48,7 @@ int __getgrent_a(FILE *f, struct group *gr, char **line, > size_t *size, char ***m > rv = errno; > free(*line); > *line = 0; > - return 0; > + return rv; > } > if (*mems) { > mem[0][0] = mems; > -- > 2.3.7 There's definitely a bug here but I don't think this patch fixes it. The exit code, which needs to be run, is still bypassed. There needs to be a "goto end" or similar instead of return, I think. Rich