Hans Leidekker : wbemprox: Avoid a crash in get_propval when the query returned no results.

Alexandre Julliard julliard at winehq.org
Tue Dec 18 13:49:05 CST 2012


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Dec 18 11:20:53 2012 +0100

wbemprox: Avoid a crash in get_propval when the query returned no results.

---

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

diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 3fdee00..1123159 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -644,22 +644,22 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
                      CIMTYPE *type, LONG *flavor )
 {
     HRESULT hr;
-    UINT column, row = view->result[index];
+    UINT column, row;
     VARTYPE vartype;
     void *val_ptr = NULL;
     LONGLONG val;
 
     if (is_system_prop( name )) return get_system_propval( view, index, name, ret, type, flavor );
-    if (!is_selected_prop( view, name )) return WBEM_E_NOT_FOUND;
+    if (!view->result || !is_selected_prop( view, name )) return WBEM_E_NOT_FOUND;
 
     hr = get_column_index( view->table, name, &column );
     if (hr != S_OK || is_method( view->table, column )) return WBEM_E_NOT_FOUND;
 
-    vartype = view->table->columns[column].vartype;
-
+    row = view->result[index];
     hr = get_value( view->table, row, column, &val );
     if (hr != S_OK) return hr;
 
+    vartype = view->table->columns[column].vartype;
     if (view->table->columns[column].type & CIM_FLAG_ARRAY)
     {
         CIMTYPE basetype = view->table->columns[column].type & CIM_TYPE_MASK;




More information about the wine-cvs mailing list