Hans Leidekker : wldap32: Return an error when ldap_parse_sort_control or ldap_parse_vlv_control is called with NULL control array .

Alexandre Julliard julliard at winehq.org
Tue Oct 7 08:53:41 CDT 2008


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Oct  6 15:46:54 2008 +0200

wldap32: Return an error when ldap_parse_sort_control or ldap_parse_vlv_control is called with NULL control array.

---

 dlls/wldap32/parse.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/dlls/wldap32/parse.c b/dlls/wldap32/parse.c
index 61c6020..daea812 100644
--- a/dlls/wldap32/parse.c
+++ b/dlls/wldap32/parse.c
@@ -333,12 +333,10 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
 
     TRACE( "(%p, %p, %p, %p)\n", ld, control, result, attr );
 
-    if (!ld) return ~0UL;
+    if (!ld || !control) return ~0UL;
 
-    if (control) {
-        controlU = controlarrayWtoU( control );
-        if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
-    }
+    controlU = controlarrayWtoU( control );
+    if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
 
 #ifdef HAVE_LDAP_PARSE_SORT_CONTROL
     if (!(ret = ldap_parse_sort_control( ld, controlU, &res, &attrU )))
@@ -439,12 +437,10 @@ INT CDECL ldap_parse_vlv_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
     TRACE( "(%p, %p, %p, %p, %p, %p)\n", ld, control, targetpos,
            listcount, context, errcode );
 
-    if (!ld) return ~0UL;
+    if (!ld || !control) return ~0UL;
 
-    if (control) {
-        controlU = controlarrayWtoU( control );
-        if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
-    }
+    controlU = controlarrayWtoU( control );
+    if (!controlU) return WLDAP32_LDAP_NO_MEMORY;
 
 #ifdef HAVE_LDAP_PARSE_VLV_CONTROL
     if (!(ret = ldap_parse_vlv_control( ld, controlU, &pos, &count,




More information about the wine-cvs mailing list