Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
binwalk
Commits
721ccbeb
Commit
721ccbeb
authored
9 years ago
by
Craig Heffner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug introduced by opening magic files as UTF-8.
parent
a14acb7a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
magic.py
src/binwalk/core/magic.py
+4
-0
No files found.
src/binwalk/core/magic.py
View file @
721ccbeb
...
...
@@ -790,6 +790,8 @@ class Magic(object):
Returns None.
'''
# Open file as UTF-8 to prevent decoding issues for non-ASCII bytes
# that may inadvertantly be in the signature file.
fp
=
codecs
.
open
(
fname
,
"r"
,
encoding
=
'utf-8'
)
lines
=
fp
.
readlines
()
self
.
parse
(
lines
)
...
...
@@ -806,6 +808,8 @@ class Magic(object):
signature
=
None
for
line
in
lines
:
# The signature lines were read in as UTF-8 unicode; be sure to treat them as strings.
line
=
str
(
line
)
# Split at the first comment delimiter (if any) and strip the result
line
=
line
.
split
(
'#'
)[
0
]
.
strip
()
# Ignore blank lines and lines that are nothing but comments.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment