Commit 90920400 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ntdll: Add ACTCTX field limit checks to RtlCreateActivationContext().

parent e8ce9979
...@@ -2853,7 +2853,6 @@ static void test_CreateActCtx(void) ...@@ -2853,7 +2853,6 @@ static void test_CreateActCtx(void)
handle = CreateActCtxW(&ctxW); handle = CreateActCtxW(&ctxW);
if (!test[i].error) if (!test[i].error)
{ {
todo_wine
ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError()); ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
ReleaseActCtx(handle); ReleaseActCtx(handle);
} }
...@@ -2868,7 +2867,6 @@ static void test_CreateActCtx(void) ...@@ -2868,7 +2867,6 @@ static void test_CreateActCtx(void)
ctxW.lpSource = sourceW; /* source without hModule must point to valid PE */ ctxW.lpSource = sourceW; /* source without hModule must point to valid PE */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
handle = CreateActCtxW(&ctxW); handle = CreateActCtxW(&ctxW);
todo_wine_if(i != 4)
ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError()); ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
ReleaseActCtx(handle); ReleaseActCtx(handle);
......
...@@ -5261,9 +5261,17 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr ) ...@@ -5261,9 +5261,17 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
TRACE("%p %08lx\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0); TRACE("%p %08lx\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0);
if (!pActCtx || pActCtx->cbSize < sizeof(*pActCtx) || #define CHECK_LIMIT( field ) (pActCtx->cbSize >= RTL_SIZEOF_THROUGH_FIELD( ACTCTXW, field ))
(pActCtx->dwFlags & ~ACTCTX_FLAGS_ALL)) if (!pActCtx || (pActCtx->dwFlags & ~ACTCTX_FLAGS_ALL) ||
!CHECK_LIMIT( lpSource ) ||
((pActCtx->dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID) && !CHECK_LIMIT( wProcessorArchitecture )) ||
((pActCtx->dwFlags & ACTCTX_FLAG_LANGID_VALID) && !CHECK_LIMIT( wLangId )) ||
((pActCtx->dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID) && !CHECK_LIMIT( lpAssemblyDirectory )) ||
((pActCtx->dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID) && !CHECK_LIMIT( lpResourceName )) ||
((pActCtx->dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID) && !CHECK_LIMIT( lpApplicationName )) ||
((pActCtx->dwFlags & ACTCTX_FLAG_HMODULE_VALID) && !CHECK_LIMIT( hModule )))
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
#undef CHECK_LIMIT
if ((pActCtx->dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID) && !pActCtx->lpResourceName) if ((pActCtx->dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID) && !pActCtx->lpResourceName)
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment