]> git.ipfire.org Git - thirdparty/pdns.git/commit
Damage control in Lua createForward() and createForward6(). 15230/head
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 26 Feb 2025 13:31:50 +0000 (14:31 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 27 Feb 2025 15:18:57 +0000 (16:18 +0100)
commite699d4a200f2dd30adffba782dbca882fe3e69ce
tree521f152e03695d34dd08fe0aa028a24981ff4e45
parent3de2be40e817dcf2037048b92766d90d3bdf68e9
Damage control in Lua createForward() and createForward6().

- make sure all computed results are passed to a ComboAddress
  constructor, which will reject ill-formed data. This wasn't the case
  in createForward, when interpreting part of the requested name as an
  ipv4 address encoded in hexadecimal (e.g. 7f000001), but the actual
  name wasn't.
  This would otherwise end up with a SERVFAIL answer and a Lua stack
  traceback containing messages such as:
    Unable to convert presentation address '4294967292.xx.yy.zz'
  for a name ending with "-4" and six hex digits.

- wrap these functions into a try/catch block in order to cope with
  possible exceptions raised by ComboAddress.
  This wasn't the case in createForward6 when the requested name
  contains at least 8 dots - this doesn't imply each component is a
  valid ipv6 chunk.

(cherry picked from commit 97800540ef65f19cd9cb6e2624682c0840a6eafc)
pdns/lua-record.cc
regression-tests.auth-py/test_LuaRecords.py