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-gitdep
binwalk
Commits
e22d2995
Commit
e22d2995
authored
Dec 02, 2013
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs in _parse_string_len.
parent
30e2686d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
smartsignature.py
src/binwalk/smartsignature.py
+3
-1
No files found.
src/binwalk/smartsignature.py
View file @
e22d2995
...
@@ -31,6 +31,7 @@ class SmartSignature:
...
@@ -31,6 +31,7 @@ class SmartSignature:
'raw-replace'
:
'
%
sraw-replace
%
s'
%
(
KEYWORD_DELIM_START
,
KEYWORD_DELIM_END
),
'raw-replace'
:
'
%
sraw-replace
%
s'
%
(
KEYWORD_DELIM_START
,
KEYWORD_DELIM_END
),
'one-of-many'
:
'
%
sone-of-many
%
s'
%
(
KEYWORD_DELIM_START
,
KEYWORD_DELIM_END
),
'one-of-many'
:
'
%
sone-of-many
%
s'
%
(
KEYWORD_DELIM_START
,
KEYWORD_DELIM_END
),
'string-len-no-arg'
:
'
%
sstring-len
%
s'
%
(
KEYWORD_DELIM_START
,
KEYWORD_DELIM_END
),
}
}
def
__init__
(
self
,
filter
,
ignore_smart_signatures
=
False
):
def
__init__
(
self
,
filter
,
ignore_smart_signatures
=
False
):
...
@@ -259,7 +260,7 @@ class SmartSignature:
...
@@ -259,7 +260,7 @@ class SmartSignature:
if
raw_string
:
if
raw_string
:
# Convert the string to an integer as a sanity check
# Convert the string to an integer as a sanity check
try
:
try
:
string_length
=
"
%
d"
%
str2int
(
raw_string
)
string_length
=
'
%
d'
%
len
(
raw_string
)
except
:
except
:
string_length
=
'0'
string_length
=
'0'
...
@@ -274,6 +275,7 @@ class SmartSignature:
...
@@ -274,6 +275,7 @@ class SmartSignature:
# Strip out *everything* after the string-len keyword, including the keyword itself.
# Strip out *everything* after the string-len keyword, including the keyword itself.
# Failure to do so can potentially allow keyword injection from a maliciously created file.
# Failure to do so can potentially allow keyword injection from a maliciously created file.
data
=
data
.
split
(
self
.
KEYWORDS
[
'string-len'
])[
0
]
+
string_length
+
end_char
data
=
data
.
split
(
self
.
KEYWORDS
[
'string-len'
])[
0
]
+
string_length
+
end_char
data
=
data
.
replace
(
self
.
KEYWORDS
[
'string-len-no-arg'
],
string_length
)
return
data
return
data
def
_strip_tags
(
self
,
data
):
def
_strip_tags
(
self
,
data
):
...
...
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