diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-10-14 06:37:50 +0000 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-10-14 06:51:22 +0000 |
commit | 470bdf3e26e433032fe7986f379cad797cdd94cd (patch) | |
tree | 73ae00e01e47eebbb8776a26c4e1aeb43e3c7517 /api/rundll32.c | |
parent | api: adapter: handle cases explicitly in dev query callback (diff) | |
download | wintun-470bdf3e26e433032fe7986f379cad797cdd94cd.tar.xz wintun-470bdf3e26e433032fe7986f379cad797cdd94cd.zip |
api: use proper instance id bounds
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'api/rundll32.c')
-rw-r--r-- | api/rundll32.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/api/rundll32.c b/api/rundll32.c index 6bdc7c9..5ea2b15 100644 --- a/api/rundll32.c +++ b/api/rundll32.c @@ -311,7 +311,7 @@ InvokeClassInstaller(_In_ LPCWSTR Action, _In_ LPCWSTR Function, _In_ HDEVINFO D { LOG(WINTUN_LOG_INFO, L"Spawning native process to %s instance", Action); - WCHAR InstanceId[MAX_INSTANCE_ID]; + WCHAR InstanceId[MAX_DEVICE_ID_LEN]; DWORD RequiredChars = _countof(InstanceId); if (!SetupDiGetDeviceInstanceIdW(DevInfo, DevInfoData, InstanceId, RequiredChars, &RequiredChars)) { @@ -374,7 +374,7 @@ CreateInstanceWin7ViaRundll32(LPWSTR InstanceId) LOG(WINTUN_LOG_INFO, L"Spawning native process to create instance"); DWORD LastError; - WCHAR Response[MAX_INSTANCE_ID + 1]; + WCHAR Response[MAX_DEVICE_ID_LEN + 1]; if (!ExecuteRunDll32(L"CreateInstanceWin7", L"", Response, _countof(Response))) { LastError = LOG_LAST_ERROR(L"Error executing worker process"); @@ -389,7 +389,7 @@ CreateInstanceWin7ViaRundll32(LPWSTR InstanceId) } LastError = wcstoul(Argv[0], NULL, 16); if (LastError == ERROR_SUCCESS) - wcsncpy_s(InstanceId, MAX_INSTANCE_ID, Argv[1], _TRUNCATE); + wcsncpy_s(InstanceId, MAX_DEVICE_ID_LEN, Argv[1], _TRUNCATE); cleanupArgv: LocalFree(Argv); cleanup: |