Nikolay Sivov : msxml3/tests: Protect from invalid array access (Coverity) .

Alexandre Julliard julliard at winehq.org
Mon Apr 7 13:20:07 CDT 2014


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Apr  7 09:24:19 2014 +0400

msxml3/tests: Protect from invalid array access (Coverity).

---

 dlls/msxml3/tests/saxreader.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 5b78e9a..1032b8c 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -1515,8 +1515,13 @@ static HRESULT WINAPI isaxattributes_getQName(
 
     ok(index >= 0 && index <= 2, "invalid index received %d\n", index);
 
-    *QName = attrqnamesW[index];
-    *QNameLength = attrqnamelen[index];
+    if (index >= 0 && index <= 2) {
+        *QName = attrqnamesW[index];
+        *QNameLength = attrqnamelen[index];
+    } else {
+        *QName = NULL;
+        *QNameLength = 0;
+    }
 
     return S_OK;
 }
@@ -1601,8 +1606,13 @@ static HRESULT WINAPI isaxattributes_getValue(ISAXAttributes* iface, int index,
 
     ok(index >= 0 && index <= 2, "invalid index received %d\n", index);
 
-    *value = attrvaluesW[index];
-    *nValue = attrvalueslen[index];
+    if (index >= 0 && index <= 2) {
+        *value = attrvaluesW[index];
+        *nValue = attrvalueslen[index];
+    } else {
+        *value = NULL;
+        *nValue = 0;
+    }
 
     return S_OK;
 }




More information about the wine-cvs mailing list