From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEGfc-0006Y0-0V for qemu-devel@nongnu.org; Thu, 22 Jan 2015 07:15:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEGfY-0006fK-9u for qemu-devel@nongnu.org; Thu, 22 Jan 2015 07:15:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEGfY-0006f9-2L for qemu-devel@nongnu.org; Thu, 22 Jan 2015 07:15:28 -0500 Date: Thu, 22 Jan 2015 07:15:23 -0500 From: Jeff Cody Message-ID: <20150122121523.GA31810@localhost.localdomain> References: <20150122113754.GD28491@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150122113754.GD28491@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 4/6] block: move string allocation from stack to the heap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, jsnow@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, Jan 22, 2015 at 11:37:54AM +0000, Stefan Hajnoczi wrote: > On Tue, Jan 20, 2015 at 12:31:31PM -0500, Jeff Cody wrote: > > Rather than allocate PATH_MAX bytes on the stack, use g_strndup() to > > dynamically allocate the string, and add an exit label for cleanup. > > > > Signed-off-by: Jeff Cody > > --- > > block.c | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > Zombie alert! > > This is a funny: > > Since September 2012 in commit 0bce597d6ec34b2af802799eb53ebc863c704d05 > ("block: convert bdrv_commit() to use bdrv_reopen()") the filename > variable has not been used. > > We continued to maintain this variable faithfully, for example, to fix a > buffer overflow in commit c2cba3d9314f972dfaf724d0ec2d018eb54c95f1 > ("block: avoid buffer overrun by using pstrcpy, not strncpy"). > > Please kill the zombie filename variable instead of switching to heap > allocation :-). Ha! OK, will kill the zombie :)