Index: src/processor/exploitability_win.cc |
=================================================================== |
--- src/processor/exploitability_win.cc (revision 1466) |
+++ src/processor/exploitability_win.cc (working copy) |
@@ -106,20 +106,16 @@ |
uint64_t stack_ptr = 0; |
uint64_t instruction_ptr = 0; |
- switch (context->GetContextCPU()) { |
- case MD_CONTEXT_X86: |
- stack_ptr = context->GetContextX86()->esp; |
- instruction_ptr = context->GetContextX86()->eip; |
- break; |
- case MD_CONTEXT_AMD64: |
- stack_ptr = context->GetContextAMD64()->rsp; |
- instruction_ptr = context->GetContextAMD64()->rip; |
- break; |
- default: |
- BPLOG(INFO) << "Unsupported architecture."; |
- return EXPLOITABILITY_ERR_PROCESSING; |
+ // Getting the instruction pointer. |
+ if (!context->GetInstructionPointer(&instruction_ptr)) { |
+ return EXPLOITABILITY_ERR_PROCESSING; |
} |
+ // Getting the stack pointer. |
+ if (!context->GetStackPointer(&stack_ptr)) { |
+ return EXPLOITABILITY_ERR_PROCESSING; |
+ } |
+ |
// Check if we are executing on the stack. |
if (instruction_ptr <= (stack_ptr + kProbableStackOffset) && |
instruction_ptr >= (stack_ptr - kProbableStackOffset)) |