From 927e9e08921fb14397f397f4ce1d424ec6737d31 Mon Sep 17 00:00:00 2001 From: Hans Leidekker <hans@codeweavers.com> Date: Mon, 6 Oct 2008 15:46:54 +0200 Subject: [PATCH] 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 file changed, 6 insertions(+), 10 deletions(-) diff --git a/dlls/wldap32/parse.c b/dlls/wldap32/parse.c index 61c6020f827..daea8123796 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, -- GitLab