vbscript: Avoid use of uninitialized variable in Global_InStrRev(). Global_InStrRev().

Gerald Pfeifer gerald at pfeifer.com
Sun Feb 15 19:11:40 CST 2015


After commit 9b0ebaeb78374d23e2d1a14ec303b3643d6daca3

  Author: Jacek Caban <jacek at codeweavers.com>
  Date:   Tue Feb 10 18:46:25 2015 +0100

    vbscript: Added InStrRev implementation.

GCC 5, rightfully from what I can tell, complains that "In function 
'Global_InStrRev': global.c:1831:5: warning: 'str2' may be used 
uninitialized in this function".

This addresses the warning by initializing str2 in the failure case
as well.

Gerald
---
 dlls/vbscript/global.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 9bcd2b2..ee68aca 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -1810,6 +1810,8 @@ static HRESULT Global_InStrRev(vbdisp_t *This, VARIANT *args, unsigned args_cnt,
         }else {
             start = SysStringLen(str1);
         }
+    } else {
+        str2 = 0;
     }
 
     if(SUCCEEDED(hres)) {
-- 
2.3.0



More information about the wine-patches mailing list