Skip to content

Commit

Permalink
Zero the out-parameter when blocking NtMapViewOfSection() in the sand…
Browse files Browse the repository at this point in the history
…box.

If mapping of a DLL into the sandboxed process is blocked then we unmap
it and return an "unsuccessful" status, but we left the DLL base-address
out-parameter set to a non-NULL value.

Reset the out-parameter to null when blocking a DLL, to ensure that
callers don't get confused into thinking the operation was successful.

This replicates the change from
https://chromium-review.googlesource.com/c/chromium/src/+/1211322 to
the ThirdPartyModulesBlocking implementation of NtMapViewOfSection().

Change-Id: I7c326a1c78870888c2141f24ae357d0f9be55a62
Reviewed-on: https://chromium-review.googlesource.com/1213561
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589704}
  • Loading branch information
Wez authored and Commit Bot committed Sep 7, 2018
1 parent e8ca310 commit 92dc522
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sandbox/win/src/target_interceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ TargetNtMapViewOfSection(NtMapViewOfSectionFunction orig_MapViewOfSection,
if (!agent->OnDllLoad(file_name, module_name, *base)) {
// Interception agent is demanding to un-map the module.
g_nt.UnmapViewOfSection(process, *base);
*base = nullptr;
ret = STATUS_UNSUCCESSFUL;
}
}
Expand Down

0 comments on commit 92dc522

Please sign in to comment.