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:
parent
6df25aafbb
commit
0d15fb330d
|
@ -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);
|
WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name);
|
||||||
if (!values)
|
if (!values)
|
||||||
{
|
|
||||||
memset(col, 0, sizeof(*col));
|
|
||||||
return E_ADS_COLUMN_NOT_SET;
|
return E_ADS_COLUMN_NOT_SET;
|
||||||
}
|
|
||||||
count = ldap_count_valuesW(values);
|
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)
|
if (!col->pADsValues)
|
||||||
{
|
{
|
||||||
ldap_value_freeW(values);
|
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);
|
WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name);
|
||||||
if (!values)
|
if (!values)
|
||||||
{
|
|
||||||
memset(col, 0, sizeof(*col));
|
|
||||||
return E_ADS_COLUMN_NOT_SET;
|
return E_ADS_COLUMN_NOT_SET;
|
||||||
}
|
|
||||||
count = ldap_count_valuesW(values);
|
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)
|
if (!col->pADsValues)
|
||||||
{
|
{
|
||||||
ldap_value_freeW(values);
|
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);
|
WCHAR **values = ldap_get_valuesW(ldap->ld, ldap_ctx->entry, name);
|
||||||
if (!values)
|
if (!values)
|
||||||
{
|
|
||||||
memset(col, 0, sizeof(*col));
|
|
||||||
return E_ADS_COLUMN_NOT_SET;
|
return E_ADS_COLUMN_NOT_SET;
|
||||||
}
|
|
||||||
count = ldap_count_valuesW(values);
|
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)
|
if (!col->pADsValues)
|
||||||
{
|
{
|
||||||
ldap_value_freeW(values);
|
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);
|
struct berval **values = ldap_get_values_lenW(ldap->ld, ldap_ctx->entry, name);
|
||||||
if (!values)
|
if (!values)
|
||||||
{
|
|
||||||
memset(col, 0, sizeof(*col));
|
|
||||||
return E_ADS_COLUMN_NOT_SET;
|
return E_ADS_COLUMN_NOT_SET;
|
||||||
}
|
|
||||||
count = ldap_count_values_len(values);
|
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)
|
if (!col->pADsValues)
|
||||||
{
|
{
|
||||||
ldap_value_free_len(values);
|
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;
|
if (!res || !name || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER;
|
||||||
|
|
||||||
|
memset(col, 0, sizeof(*col));
|
||||||
|
|
||||||
if (!wcsicmp(name, L"ADsPath"))
|
if (!wcsicmp(name, L"ADsPath"))
|
||||||
{
|
{
|
||||||
WCHAR *dn = ldap_get_dnW(ldap->ld, ldap_ctx->entry);
|
WCHAR *dn = ldap_get_dnW(ldap->ld, ldap_ctx->entry);
|
||||||
|
|
Loading…
Reference in New Issue