mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[4091] Changed to require at least one hexdigit
This commit is contained in:
parent
a496523c86
commit
5c780bdd6e
@ -29,19 +29,14 @@ TokenString::evaluate(const Pkt& /*pkt*/, ValueStack& values) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TokenHexString::TokenHexString(const string& str) : value_("") {
|
TokenHexString::TokenHexString(const string& str) : value_("") {
|
||||||
// Check "0x" or "0x" in front
|
// Check string starts "0x" or "0x" and has at least one additional character.
|
||||||
if ((str.size() < 2) ||
|
if ((str.size() < 3) ||
|
||||||
(str[0] != '0') ||
|
(str[0] != '0') ||
|
||||||
((str[1] != 'x') && (str[1] != 'X'))) {
|
((str[1] != 'x') && (str[1] != 'X'))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string digits = str.substr(2);
|
string digits = str.substr(2);
|
||||||
|
|
||||||
// Eliminate the no digit case first
|
|
||||||
if (digits.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transform string of hexadecimal digits into binary format
|
// Transform string of hexadecimal digits into binary format
|
||||||
vector<uint8_t> binary;
|
vector<uint8_t> binary;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user