Check that the length of pInfo is large enough before
dereferencing it.

Signed-off-by: Sean Hefty <[email protected]>
---
 trunk/ulp/netdirect2/user/nd_adapter.cpp |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/trunk/ulp/netdirect2/user/nd_adapter.cpp 
b/trunk/ulp/netdirect2/user/nd_adapter.cpp
index 34e9fc7..55fba91 100644
--- a/trunk/ulp/netdirect2/user/nd_adapter.cpp
+++ b/trunk/ulp/netdirect2/user/nd_adapter.cpp
@@ -116,16 +116,17 @@ Query(ND_ADAPTER_INFO* pInfo, SIZE_T* pcbInfo)
        WV_DEVICE_ATTRIBUTES attr;
        HRESULT hr;
 
-       if (pInfo != NULL && pInfo->InfoVersion != 1) {
-               return ND_NOT_SUPPORTED;
-       }
-
        if (*pcbInfo < sizeof(ND_ADAPTER_INFO)) {
                hr = ND_BUFFER_OVERFLOW;
                goto out;
        }
 
-       hr = m_pWvDevice->Query(&attr);
+       if (pInfo != NULL && pInfo->InfoVersion != 1) {
+               hr = ND_NOT_SUPPORTED;
+               goto out;
+       }
+
+       hr = NDConvertWVStatus(m_pWvDevice->Query(&attr));
        if (FAILED(hr)) {
                goto out;
        }
@@ -157,7 +158,7 @@ Query(ND_ADAPTER_INFO* pInfo, SIZE_T* pcbInfo)
 
 out:
        *pcbInfo = sizeof(ND_ADAPTER_INFO);
-       return NDConvertWVStatus(hr);
+       return hr;
 }
 
 STDMETHODIMP CNDAdapter::

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to