[PATCH] kernel32: Make sure we reference stack data still in scope (Coverity)

Marcus Meissner marcus at jet.franken.de
Wed Nov 2 05:53:40 CDT 2011


Hi,

block goes out of scope with superblock pointing to it... While this
might just work, it is compiler dependend. Move the block array a bit
up to make it stable.

CID 5310

Ciao, Marcus
---
 dlls/kernel32/volume.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 6a0ca25..aca679f 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -572,6 +572,8 @@ static void VOLUME_GetSuperblockLabel( const UNICODE_STRING *device, HANDLE hand
 static DWORD VOLUME_GetSuperblockSerial( const UNICODE_STRING *device, HANDLE handle,
                                          enum fs_type type, const BYTE *superblock )
 {
+    BYTE block[BLOCK_SIZE];
+
     switch(type)
     {
     case FS_ERROR:
@@ -584,13 +586,9 @@ static DWORD VOLUME_GetSuperblockSerial( const UNICODE_STRING *device, HANDLE ha
         return GETLONG( superblock, 0x33 );
     case FS_UDF:
         {
-            BYTE block[BLOCK_SIZE];
-
             if (!VOLUME_ReadCDBlock(handle, block, 257*BLOCK_SIZE))
                 break;
-
             superblock = block;
-
             /* fallthrough */
         }
     case FS_ISO9660:
-- 
1.7.3.4




More information about the wine-patches mailing list