Skip to content

Commit

Permalink
Fix path creation to be os-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
vahaan committed May 8, 2015
1 parent cb2e198 commit 97b4b6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fuzzpool.py
Expand Up @@ -60,7 +60,7 @@ def get_valid_case(self, path):
raise IOError('Valid-case path "%s" is not a directory' % path)
self.valid_cases[path] = []
for filename in os.listdir(path):
filehandle = open(path + "/" + filename, "r")
filehandle = open(os.path.join(path, filename), "r")
self.valid_cases[path].append(filehandle.read())
self.valid_cases_iter[path] = itertools.cycle(iter(self.valid_cases[path]))
return self.valid_cases_iter[path].next()
Expand All @@ -85,15 +85,15 @@ def run_fuzzer(self, valid_case_directory, no_of_fuzzcases, radamsacmd):
# Run Radamsa
try:
subprocess.check_call(
[radamsacmd, "-o", fuzz_case_directory + "/%n.fuzz", "-n",
[radamsacmd, "-o", os.path.join(fuzz_case_directory, "%n.fuzz"), "-n",
str(no_of_fuzzcases), "-r", valid_case_directory])
except subprocess.CalledProcessError as error:
raise error

# Read the fuzz cases from the output directory and return as list
fuzzlist = []
for filename in os.listdir(fuzz_case_directory):
filehandle = open(fuzz_case_directory + "/" + filename, "r")
filehandle = open(os.path.join(fuzz_case_directory, filename), "r")
fuzzlist.append(filehandle.read())
shutil.rmtree(fuzz_case_directory)
return fuzzlist

0 comments on commit 97b4b6f

Please sign in to comment.