From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEG5L-000072-Iv for qemu-devel@nongnu.org; Thu, 22 Jan 2015 06:38:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEG5H-0007wN-HR for qemu-devel@nongnu.org; Thu, 22 Jan 2015 06:38:03 -0500 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:63780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEG5H-0007uu-6c for qemu-devel@nongnu.org; Thu, 22 Jan 2015 06:37:59 -0500 Received: by mail-wg0-f51.google.com with SMTP id l18so1168492wgh.10 for ; Thu, 22 Jan 2015 03:37:58 -0800 (PST) Date: Thu, 22 Jan 2015 11:37:54 +0000 From: Stefan Hajnoczi Message-ID: <20150122113754.GD28491@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fOHHtNG4YXGJ0yqR" Content-Disposition: inline In-Reply-To: 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: Jeff Cody Cc: kwolf@redhat.com, jsnow@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com --fOHHtNG4YXGJ0yqR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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 :-). --fOHHtNG4YXGJ0yqR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUwOESAAoJEJykq7OBq3PI5PAH/j3b/DRFaLqSX4EJ06sfya0v /IvWzOYRiioW4TN6AAx7oek6/dWS4NMpJU5RdyWE6S8mhmxdrRIzL/yzB2gm/3eV MtDBEduNWD0W/tnUuGFzTfukw6K7uBR/GDTvUpZdVSN/ZeyGsNaaR/FUUhSIQfVY a7t/FRTdZlGr5II2nc0tr5ntfqdHGFs0BPDpvMq0tnsLwRjA75j/5VTmkmqxyS5G ZW5SpvldyBkaOTZQMpSy1keH/FOGJARHovBIvQPAfb3vDD5uPrTnJLTxehnzdu23 vbfSrjW8HQW6aC2lQFtLKIwk2+mIc4szSpPgLKzoiMTZ/ycj7+1HFhwXPNAVswY= =6l9L -----END PGP SIGNATURE----- --fOHHtNG4YXGJ0yqR--