[PATCH 3/7] adsldp: Always fully initialize returned column values.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> --- dlls/adsldp/adsldp.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c index a4467c0abe..2b5f621fba 100644 --- a/dlls/adsldp/adsldp.c +++ b/dlls/adsldp/adsldp.c @@ -1393,13 +1393,10 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex { WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name); if (!values) - { - memset(col, 0, sizeof(*col)); return E_ADS_COLUMN_NOT_SET; - } count = ldap_count_valuesW(values); - col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + col->pADsValues = heap_alloc_zero(count * sizeof(col->pADsValues[0])); if (!col->pADsValues) { ldap_value_freeW(values); @@ -1421,13 +1418,10 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex { WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name); if (!values) - { - memset(col, 0, sizeof(*col)); return E_ADS_COLUMN_NOT_SET; - } count = ldap_count_valuesW(values); - col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + col->pADsValues = heap_alloc_zero(count * sizeof(col->pADsValues[0])); if (!col->pADsValues) { ldap_value_freeW(values); @@ -1459,13 +1453,10 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex { WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name); if (!values) - { - memset(col, 0, sizeof(*col)); return E_ADS_COLUMN_NOT_SET; - } count = ldap_count_valuesW(values); - col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + col->pADsValues = heap_alloc_zero(count * sizeof(col->pADsValues[0])); if (!col->pADsValues) { ldap_value_freeW(values); @@ -1488,13 +1479,10 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex { struct berval **values = ldap_get_values_lenW(ldap->ld, ldap_ctx->entry, name); if (!values) - { - memset(col, 0, sizeof(*col)); return E_ADS_COLUMN_NOT_SET; - } count = ldap_count_values_len(values); - col->pADsValues = heap_alloc(count * sizeof(col->pADsValues[0])); + col->pADsValues = heap_alloc_zero(count * sizeof(col->pADsValues[0])); if (!col->pADsValues) { ldap_value_free_len(values); @@ -1533,6 +1521,8 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL if (!res || !name || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER; + memset(col, 0, sizeof(*col)); + if (!wcsicmp(name, L"ADsPath")) { WCHAR *dn = ldap_get_dnW(ldap->ld, ldap_ctx->entry); -- 2.25.2
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=68974 Your paranoid android. === debiant (64 bit WoW report) === wldap32: parse.c:166: Test failed: ldap_bind_s failed 0x00000051
participants (2)
-
Dmitry Timoshkov -
Marvin