From 6ed7d9dd1c1d009d760cead40cc8599c3f71620a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 7 Apr 2014 09:24:19 +0400 Subject: [PATCH] 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 5b78e9a2251..1032b8cdc78 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; }