From eaae78ac334b90ff2fadebe2b7469a38d2245677 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 18 Jan 2012 10:38:20 +0100 Subject: [PATCH 26/52] block: Fix bdrv_open use after free RH-Author: Markus Armbruster Message-id: <1326883126-22053-27-git-send-email-armbru@redhat.com> Patchwork-id: 36604 O-Subject: [RHEL-6.3 PATCH qemu-kvm 26/52] block: Fix bdrv_open use after free Bugzilla: 758194 RH-Acked-by: Miroslav Rezanina RH-Acked-by: Laszlo Ersek RH-Acked-by: Amit Shah From: Kevin Wolf tmp_filename was used outside the block it was defined in, i.e. after it went out of scope. Move its declaration to the top level. Signed-off-by: Kevin Wolf (cherry picked from commit 2b5728164fcf5211bbae8d3c2fc6df62dd6b2295) Signed-off-by: Markus Armbruster --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 9899696..2f1f6a7 100644 --- a/block.c +++ b/block.c @@ -525,6 +525,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret; + char tmp_filename[PATH_MAX]; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; @@ -532,7 +533,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, int is_protocol = 0; BlockDriver *bdrv_qcow2; QEMUOptionParameter *options; - char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; /* if snapshot, we create a temporary backing file and open it -- 1.7.7.5