diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-19 21:53:21 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-19 21:53:21 +0000 |
commit | 857218b6d36e1ead540c49c35330b50333085acb (patch) | |
tree | 027f12d764927941a8f1a611a5c155453c472cf4 /sandbox/src | |
parent | 1c697f540722664820c3cfb5e00b9cb935b44f00 (diff) | |
download | chromium_src-857218b6d36e1ead540c49c35330b50333085acb.zip chromium_src-857218b6d36e1ead540c49c35330b50333085acb.tar.gz chromium_src-857218b6d36e1ead540c49c35330b50333085acb.tar.bz2 |
Fix memory corruption when EAT patching in sandbox
Review URL: http://codereview.chromium.org/3174
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/src')
-rw-r--r-- | sandbox/src/interception_agent.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sandbox/src/interception_agent.cc b/sandbox/src/interception_agent.cc index 61ca03a..eefac61 100644 --- a/sandbox/src/interception_agent.cc +++ b/sandbox/src/interception_agent.cc @@ -31,22 +31,22 @@ SANDBOX_INTERCEPT NtExports g_nt; SANDBOX_INTERCEPT SharedMemory* g_interceptions = NULL; InterceptionAgent* InterceptionAgent::GetInterceptionAgent() { - static InterceptionAgent* s_singleton_pointer = NULL; - if (!s_singleton_pointer) { + static InterceptionAgent* s_singleton = NULL; + if (!s_singleton) { if (!g_interceptions) return NULL; - size_t object_bytes = g_interceptions->num_intercepted_dlls * sizeof(void*); - s_singleton_pointer = reinterpret_cast<InterceptionAgent*>( - new(NT_ALLOC) char[object_bytes]); + size_t array_bytes = g_interceptions->num_intercepted_dlls * sizeof(void*); + s_singleton = reinterpret_cast<InterceptionAgent*>( + new(NT_ALLOC) char[array_bytes + sizeof(InterceptionAgent)]); - bool success = s_singleton_pointer->Init(g_interceptions); + bool success = s_singleton->Init(g_interceptions); if (!success) { - operator delete(s_singleton_pointer, NT_ALLOC); - s_singleton_pointer = NULL; + operator delete(s_singleton, NT_ALLOC); + s_singleton = NULL; } } - return s_singleton_pointer; + return s_singleton; } bool InterceptionAgent::Init(SharedMemory* shared_memory) { |