From 0cd19c46efbf44cd78cd1838b9d527ca04a94187 Mon Sep 17 00:00:00 2001
From: Anh <zenpoems@gmail.com>
Date: Wed, 12 Sep 2018 15:56:54 -0400
Subject: [PATCH] Make sure fork server entry point doesn't get instrumented

---
 afl_transforms/tools/zafl/zafl.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/afl_transforms/tools/zafl/zafl.cpp b/afl_transforms/tools/zafl/zafl.cpp
index 2b842da..e9b7d65 100644
--- a/afl_transforms/tools/zafl/zafl.cpp
+++ b/afl_transforms/tools/zafl/zafl.cpp
@@ -29,6 +29,7 @@
 #include <string.h> 
 #include <algorithm>
 #include <cctype>
+#include <sstream>
 #include <libIRDB-cfg.hpp>
 #include <libElfDep.hpp>
 #include <Rewrite_Utility.hpp>
@@ -519,11 +520,15 @@ void Zafl_t::insertForkServer(Instruction_t* p_entry)
 {
 	assert(p_entry);
 
-	cout << "inserting fork server code at address: " << hex << p_entry->GetAddress()->GetVirtualOffset() << dec;
+	stringstream ss;
+	ss << "0x" << hex << p_entry->GetAddress()->GetVirtualOffset();
+	cout << "inserting fork server code at address: " << ss.str() << dec << endl;
 	if (p_entry->GetFunction())
 		cout << " function: " << p_entry->GetFunction()->GetName();
 	cout << endl;
 
+	m_blacklist.insert(ss.str());
+
 	// insert the PLT needed
 	auto ed=ElfDependencies_t(getFileIR());
 	auto plt_zafl_initAflForkServer=ed.appendPltEntry("zafl_initAflForkServer");
-- 
GitLab