Created
September 24, 2013 15:08
-
-
Save pakt/6686201 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pintraces/pin_taint.cpp b/pintraces/pin_taint.cpp | |
index 659ddc1..3a69392 100644 | |
--- a/pintraces/pin_taint.cpp | |
+++ b/pintraces/pin_taint.cpp | |
@@ -218,6 +218,21 @@ context TaintTracker::getMemory() | |
FrameOption_t TaintTracker::introMemTaint(uint32_t addr, uint32_t length, const char *source, int64_t offset) { | |
FrameOption_t fb; | |
+ uint32_t buffer_size; | |
+ uint8_t value; | |
+ | |
+ //Length can be bigger than the buffer size, so take a minimum of these | |
+ //two values. | |
+ buffer_size = 0; | |
+ for (unsigned int i = 0; i < length; i++) { | |
+ if(PIN_SafeCopy((void*) &value, (void*) (addr+i), 1) != 1){ | |
+ break; | |
+ } | |
+ buffer_size++; | |
+ } | |
+ cerr << "buffer_size: " << buffer_size << ", requested length: " << length << | |
+ endl; | |
+ length = min(length, buffer_size); | |
if ((*pf)(addr, length, source) && length > 0) { | |
@@ -250,7 +265,6 @@ FrameOption_t TaintTracker::introMemTaint(uint32_t addr, uint32_t length, const | |
off += i; | |
} | |
tfi->set_offset(off); | |
- uint8_t value; | |
assert (PIN_SafeCopy((void*) &value, (void*) (addr+i), 1) == 1); | |
tfi->set_value((void*) &value, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment