Skip to content

Commit

Permalink
Fixes for Python3.6+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
vmayoral committed Jan 16, 2020
1 parent ac998c7 commit 0a49189
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions flawfinder
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""flawfinder: Find potential security flaws ("hits") in source code.
Usage:
Expand Down Expand Up @@ -418,9 +418,12 @@ class Hit(object):
# Show as CSV format
def show_csv(self):
csv_writer.writerow([
self.filename, self.line, self.column, self.level, self.category,
self.name, self.warning, self.suggestion, self.note,
self.cwes(), self.context_text, self.fingerprint()
self.filename.encode('utf8'), self.line,
self.column, self.level,
self.category.encode('utf8'), self.name.encode('utf8'),
self.warning.encode('utf8'), self.suggestion.encode('utf8'),
self.note.encode('utf8'), self.cwes().encode('utf8'),
self.context_text.encode('utf8'), self.fingerprint().encode('utf8')
])

def show(self):
Expand Down Expand Up @@ -1485,7 +1488,7 @@ def process_c_file(f, patch_infos):
num_links_skipped += 1
return
try:
my_input = open(f, "r")
my_input = open(f, "r", encoding="ISO-8859-1")
except BaseException:
print("Error: failed to open", h(f))
sys.exit(14)
Expand Down

0 comments on commit 0a49189

Please sign in to comment.