summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon <[email protected]>2015-12-22 16:20:05 -0800
committerJon <[email protected]>2015-12-22 16:20:05 -0800
commita4ad8067ebffdecbf67b916c4185c116e8fd8757 (patch)
tree048f43f8fa9c3e99d3df224146b1f7c9611e5529
parentc4ba9c629505328d040d318a6193b966d7dbc800 (diff)
Avoid 0x80000003 on 32-bit Windows in msnmntr.
The exception occurs in MonitorCoStreamFlowDeletion, but the bug is in MonitorCoCreateFlowContext. In 32-bit Windows, the high bit of kernel mode pointers is set, and the pointer value is 0x80000000 or above. Casting 0x80000000 to a UINT64 yields 0xffffffff80000000 because of sign extension. ULongLongToULongPtr converts 0xffffffff80000000 to 0xffffffff. Boom. Cast using an intermediate uintptr_t to avoid the sign extension in the first place.
-rw-r--r--network/trans/msnmntr/sys/msnmntr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/network/trans/msnmntr/sys/msnmntr.c b/network/trans/msnmntr/sys/msnmntr.c
index 1aa33431..a2c59cf2 100644
--- a/network/trans/msnmntr/sys/msnmntr.c
+++ b/network/trans/msnmntr/sys/msnmntr.c
@@ -384,7 +384,7 @@ cleanup:
flowContext = NULL;
}
- return (UINT64) flowContext;
+ return (UINT64)(uintptr_t) flowContext;
}
NTSTATUS MonitorCoInitialize(_Inout_ DEVICE_OBJECT* deviceObject)