From: Francis Dupont Date: Thu, 5 Nov 2015 22:32:15 +0000 (+0100) Subject: [4091] Changed to require at least one hexdigit X-Git-Tag: trac4115_base~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c780bdd6e201b34ee4ceb35c8a40ea43132b08e;p=thirdparty%2Fkea.git [4091] Changed to require at least one hexdigit --- diff --git a/src/lib/eval/token.cc b/src/lib/eval/token.cc index bef3b32723..ea01f11a76 100644 --- a/src/lib/eval/token.cc +++ b/src/lib/eval/token.cc @@ -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 binary; try {