From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbQEn-0004bv-JE for qemu-devel@nongnu.org; Thu, 22 Nov 2012 01:26:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbQEm-0005Xe-Ew for qemu-devel@nongnu.org; Thu, 22 Nov 2012 01:26:13 -0500 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:33727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbQEm-0005WN-8i for qemu-devel@nongnu.org; Thu, 22 Nov 2012 01:26:12 -0500 From: Stefan Weil Date: Thu, 22 Nov 2012 07:25:48 +0100 Message-Id: <1353565548-10010-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH for 1.3 v2] block: Fix regression for MinGW (assertion caused by short string) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Blue Swirl , Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Stefan Weil The local string tmp_filename is passed to function get_tmp_filename which expects a string with minimum size MAX_PATH for w32 hosts. MAX_PATH is 260 and PATH_MAX is 259, so tmp_filename was too short. Commit eba25057b9a5e19d10ace2bc7716667a31297169 introduced this regression. Signed-off-by: Stefan Weil --- v2: Added TODO comment as suggested by Stefan Hajnoczi. Hi Anthony, hi Blue, this fix is needed for 1.3 to avoid a fatal assertion on Windows. As discussed on qemu-devel, it is a minimal solution and can be replaced by a better one after 1.3. Please commit it to git master. Regards Stefan block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 854ebd6..c05875f 100644 --- a/block.c +++ b/block.c @@ -787,7 +787,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *drv) { int ret; - char tmp_filename[PATH_MAX]; + /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ + char tmp_filename[PATH_MAX + 1]; if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; -- 1.7.10.4