Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
5c780bdd
Commit
5c780bdd
authored
Nov 05, 2015
by
Francis Dupont
Browse files
[4091] Changed to require at least one hexdigit
parent
a496523c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/eval/token.cc
View file @
5c780bdd
...
...
@@ -29,19 +29,14 @@ TokenString::evaluate(const Pkt& /*pkt*/, ValueStack& values) {
}
TokenHexString
::
TokenHexString
(
const
string
&
str
)
:
value_
(
""
)
{
// Check
"0x" or "0x" in front
if
((
str
.
size
()
<
2
)
||
// Check
string starts "0x" or "0x" and has at least one additional character.
if
((
str
.
size
()
<
3
)
||
(
str
[
0
]
!=
'0'
)
||
((
str
[
1
]
!=
'x'
)
&&
(
str
[
1
]
!=
'X'
)))
{
return
;
}
string
digits
=
str
.
substr
(
2
);
// Eliminate the no digit case first
if
(
digits
.
empty
())
{
return
;
}
// Transform string of hexadecimal digits into binary format
vector
<
uint8_t
>
binary
;
try
{
...
...
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