Mike McCormack : msi: Fix MsiRecordGetString for a null buffer and non-zero buffer length.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 28 05:09:27 CDT 2006


Module: wine
Branch: master
Commit: b9d6ec3b875ff463ae09495ad64ffc11007fad03
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=b9d6ec3b875ff463ae09495ad64ffc11007fad03

Author: Mike McCormack <mike at codeweavers.com>
Date:   Mon Aug 28 16:51:11 2006 +0900

msi: Fix MsiRecordGetString for a null buffer and non-zero buffer length.

---

 dlls/msi/record.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/msi/record.c b/dlls/msi/record.c
index 159fc0b..6c9a567 100644
--- a/dlls/msi/record.c
+++ b/dlls/msi/record.c
@@ -307,7 +307,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec
                              NULL, 0 , NULL, NULL);
         WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1,
                              szValue, *pcchValue, NULL, NULL);
-        if( *pcchValue && len>*pcchValue )
+        if( szValue && *pcchValue && len>*pcchValue )
             szValue[*pcchValue-1] = 0;
         if( len )
             len--;
@@ -321,7 +321,7 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec
         break;
     }
 
-    if( *pcchValue <= len )
+    if( szValue && *pcchValue <= len )
         ret = ERROR_MORE_DATA;
     *pcchValue = len;
 
@@ -383,13 +383,13 @@ UINT MSI_RecordGetStringW(MSIRECORD *rec
         break;
     case MSIFIELD_NULL:
         len = 1;
-        if( *pcchValue > 0 )
+        if( szValue && *pcchValue > 0 )
             szValue[0] = 0;
     default:
         break;
     }
 
-    if( *pcchValue <= len )
+    if( szValue && *pcchValue <= len )
         ret = ERROR_MORE_DATA;
     *pcchValue = len;
 




More information about the wine-cvs mailing list