Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ HandlerResolver::LoadRequestHandlerAssembly(const IHttpApplication &pApplication

LOG_INFOF(L"Loading request handler: '%ls'", handlerDllPath.c_str());

hRequestHandlerDll = LoadLibrary(handlerDllPath.c_str());
hRequestHandlerDll = LoadLibraryEx(handlerDllPath.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will search 4 places -- current dll, app, System32 and any AddDllDirectory/SetDllDirectory. Do we need all those places?

I see in the code of this dll we may SetDllDirectory to the current directory. Is that relevant?

LOG_LAST_ERROR_IF(!SetDllDirectory(currentDirectory.c_str()));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether it's well defined exactly where it should look and that's something more limited than this range. As far as security goes, I guess we trust app directory/dll directory. We do not necessarily trust current directory, in general.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the only behavioral difference introduced here is that we now search the directory where the handler DLL is as well. The other places (app dir, system32, etc.) are already being searched with the current LoadLibrary code.

The inprocessapplication.cpp code you linked to is not yet relevant at this point; that comes later.

RETURN_LAST_ERROR_IF_NULL(hRequestHandlerDll);

if (preventUnload)
Expand Down
Loading