New attempt, with only mandatory comments.
Pierre Schweitzer pierre@reactos.org writes:
+static DWORD _enumeratorRememberedW(PWNetEnumerator enumerator, DWORD* user_count,
void* user_buffer, DWORD* user_size)
+{
- HKEY registry, connection;
- WCHAR buffer[255];
- DWORD index, ret, type, len, size, provider_size, remote_size, full_size, total_count, size_left = *user_size;
- NETRESOURCEW * net_buffer = user_buffer;
- WCHAR * str;
- if (!enumerator)
return WN_BAD_POINTER;
- if (enumerator->enumType != WNET_ENUMERATOR_TYPE_REMEMBERED)
return WN_BAD_VALUE;
- if (!user_count || !user_buffer || !user_size)
return WN_BAD_POINTER;
- if (!providerTable)
return WN_NO_NETWORK;
Please don't add unnecessary checks. enumerator can't be null, the type has already been checked, and at least user_size has been dereferenced already. You should only add checks for things that a real app is triggering.
You're right, I basically copied/pasted the previous enumerator, which is not correct either. I may submit a patch to address this later on, if we consider this critical. I also removed the providertable check here that makes no sense regarding to the context.
Find attached a patch that fixes it.
Le 19/11/2018 à 19:12, Alexandre Julliard a écrit :
Pierre Schweitzer pierre@reactos.org writes:
+static DWORD _enumeratorRememberedW(PWNetEnumerator enumerator, DWORD* user_count,
void* user_buffer, DWORD* user_size)
+{
- HKEY registry, connection;
- WCHAR buffer[255];
- DWORD index, ret, type, len, size, provider_size, remote_size, full_size, total_count, size_left = *user_size;
- NETRESOURCEW * net_buffer = user_buffer;
- WCHAR * str;
- if (!enumerator)
return WN_BAD_POINTER;
- if (enumerator->enumType != WNET_ENUMERATOR_TYPE_REMEMBERED)
return WN_BAD_VALUE;
- if (!user_count || !user_buffer || !user_size)
return WN_BAD_POINTER;
- if (!providerTable)
return WN_NO_NETWORK;
Please don't add unnecessary checks. enumerator can't be null, the type has already been checked, and at least user_size has been dereferenced already. You should only add checks for things that a real app is triggering.