Skip to content

Commit 0a49189

Browse files
committed
Fixes for Python3.6+ support
1 parent ac998c7 commit 0a49189

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

flawfinder

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
"""flawfinder: Find potential security flaws ("hits") in source code.
44
Usage:
@@ -418,9 +418,12 @@ class Hit(object):
418418
# Show as CSV format
419419
def show_csv(self):
420420
csv_writer.writerow([
421-
self.filename, self.line, self.column, self.level, self.category,
422-
self.name, self.warning, self.suggestion, self.note,
423-
self.cwes(), self.context_text, self.fingerprint()
421+
self.filename.encode('utf8'), self.line,
422+
self.column, self.level,
423+
self.category.encode('utf8'), self.name.encode('utf8'),
424+
self.warning.encode('utf8'), self.suggestion.encode('utf8'),
425+
self.note.encode('utf8'), self.cwes().encode('utf8'),
426+
self.context_text.encode('utf8'), self.fingerprint().encode('utf8')
424427
])
425428

426429
def show(self):
@@ -1485,7 +1488,7 @@ def process_c_file(f, patch_infos):
14851488
num_links_skipped += 1
14861489
return
14871490
try:
1488-
my_input = open(f, "r")
1491+
my_input = open(f, "r", encoding="ISO-8859-1")
14891492
except BaseException:
14901493
print("Error: failed to open", h(f))
14911494
sys.exit(14)

0 commit comments

Comments
 (0)