[SHELL32][SHELLEXT] IEnumIDList::Next must handle pceltFetched and memory errors correctly (#5820)

- pceltFetched can be NULL if the caller is not requesting multiple items.
- All entries returned in rgelt must be valid, they cannot be NULL.
This commit is contained in:
Whindmar Saksit
2023-11-13 16:31:37 +01:00
committed by GitHub
parent b4b1c5b9aa
commit f283a3f9ae
4 changed files with 42 additions and 17 deletions

View File

@@ -277,9 +277,17 @@ CEnumIDList::Next(
for (i = 0; i < celt; i++)
{
if (!m_pCurrent)
{
hr = S_FALSE;
break;
}
temp = ILClone(m_pCurrent->pidl);
if (!temp)
{
hr = i ? S_FALSE : E_OUTOFMEMORY;
break;
}
rgelt[i] = temp;
m_pCurrent = m_pCurrent->pNext;
}