[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 4/6] block: move string allocation from stack
From: |
Jeff Cody |
Subject: |
Re: [Qemu-devel] [PATCH v2 4/6] block: move string allocation from stack to the heap |
Date: |
Thu, 22 Jan 2015 07:15:23 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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 <address@hidden>
> > ---
> > 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 :)
- [Qemu-devel] [PATCH v2 2/6] block: vmdk - move string allocations from stack to the heap, (continued)
- [Qemu-devel] [PATCH v2 2/6] block: vmdk - move string allocations from stack to the heap, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 3/6] block: qapi - move string allocation from stack to the heap, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 4/6] block: move string allocation from stack to the heap, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 5/6] block: mirror - change string allocation to 2-bytes, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 1/6] block: vmdk - make ret variable usage clear, Jeff Cody, 2015/01/20
- [Qemu-devel] [PATCH v2 6/6] block: update string sizes for filename, backing_file, exact_filename, Jeff Cody, 2015/01/20