api: check that GUID is valid before assuming it's in use
ROOT/NET/000X could have been claimed by a different driver, so we want to double check. Link: https://lists.zx2c4.com/pipermail/wireguard/2021-May/006716.html Reported-by: Piotr Sobczak <piotrs@glosol.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
d9555bea1b
commit
1efbd14c2c
@ -1452,8 +1452,13 @@ static _Return_type_success_(return != NULL) WINTUN_ADAPTER *CreateAdapter(
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, RegPath, 0, KEY_QUERY_VALUE, &Key) == ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey(Key);
|
||||
SetLastError(LOG_ERROR(ERROR_ALREADY_EXISTS, L"Requested GUID is already in use: %s", RequestedGUIDStr));
|
||||
return NULL;
|
||||
NET_LUID Luid;
|
||||
if (ConvertInterfaceGuidToLuid(RequestedGUID, &Luid) == NO_ERROR)
|
||||
{
|
||||
SetLastError(
|
||||
LOG_ERROR(ERROR_ALREADY_EXISTS, L"Requested GUID is already in use: %s", RequestedGUIDStr));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
LOG(WINTUN_LOG_WARN, L"Requested GUID %s has leftover residue", RequestedGUIDStr);
|
||||
HANDLE OriginalToken;
|
||||
|
Loading…
Reference in New Issue
Block a user