From: Remi Gacogne Date: Mon, 3 Feb 2025 13:10:43 +0000 (+0100) Subject: Merge pull request #15054 from neheb/bb X-Git-Tag: dnsdist-2.0.0-alpha1~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=76340f12751c1f4e9414a1eb0b4a094eb5b66a89;p=thirdparty%2Fpdns.git Merge pull request #15054 from neheb/bb more clang-tidy fixups --- 76340f12751c1f4e9414a1eb0b4a094eb5b66a89 diff --cc pdns/lua-record.cc index f450cc0a0c,13b97f46b1..36bfdccd0a --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@@ -1130,18 -1130,8 +1130,18 @@@ static void setupLuaRecords(LuaContext } string dashed=ip6.toString(); - boost::replace_all(dashed, ":", "-"); + std::replace(dashed.begin(), dashed.end(), ':', '-'); + // https://github.com/PowerDNS/pdns/issues/7524 + if (boost::ends_with(dashed, "-")) { + // "a--a-" -> "a--a-0" + dashed.push_back('0'); + } + if (boost::starts_with(dashed, "-") || dashed.compare(2, 2, "--") == 0) { + // "-a--a" -> "0-a--a" "aa--a" -> "0aa--a" + dashed.insert(0, "0"); + } + for(int i=31; i>=0; --i) fmt % labels[i]; fmt % dashed;