adsldp: Always fully initialize returned column values.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2020-04-06 18:11:44 +08:00 committed by Alexandre Julliard
parent 6df25aafbb
commit 0d15fb330d
1 changed files with 6 additions and 16 deletions

View File

@ -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);