From: Peter van Dijk Date: Tue, 20 Dec 2022 20:23:01 +0000 (+0100) Subject: auth LUA createForward: accept any length of prefix for the hex address X-Git-Tag: dnsdist-1.8.0-rc3~11^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9af5ff1175ec98bc70a5a269aaa9740333ec5dc5;p=thirdparty%2Fpdns.git auth LUA createForward: accept any length of prefix for the hex address --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index d221ce92be..e231da745b 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -705,7 +705,7 @@ static void setupLuaRecords(LuaContext& lua) } ret.resize(ret.size() - 1); // remove trailing dot after last octet return ret; - } else if(parts[0].length() == 10 && sscanf(parts[0].c_str()+2, "%02x%02x%02x%02x", &x1, &x2, &x3, &x4)==4) { + } else if(parts[0].length() >= 8 && sscanf(parts[0].c_str()+(parts[0].length()-8), "%02x%02x%02x%02x", &x1, &x2, &x3, &x4)==4) { return std::to_string(x1)+"."+std::to_string(x2)+"."+std::to_string(x3)+"."+std::to_string(x4); } }