]> git.ipfire.org Git - thirdparty/pdns.git/commit
Properly encode json string containing binary data 12742/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 2 Dec 2022 08:16:55 +0000 (09:16 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 13 Apr 2023 10:53:39 +0000 (12:53 +0200)
commit1c1bf29fb87c4adeee8f1d9d702e7679cd48e296
tree3854f646aed283723d6d1687abf67e7a43cd32f1
parentb871070c7483ac2c261cd555ca7372ea4ccb95f0
Properly encode json string containing binary data

The existing code assumes the strings are alreayd valid UTF8 and contain potential out-of-bound accesses.

Also urlEncode path in log lines, as it trips pytest.xml:

Running tests...

$ 'pytest' '--junitxml=pytest.xml' '-v'
==STDOUT===

==STDERRR===
  File "/home/otto/pdns/regression-tests.api/runtests.py", line 304, in <module>
    print(serverproc.stderr.read())
  File "/usr/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 4304: invalid continuation byte

There might be more places where this is needed.

(cherry picked from commit 1478a2c8713535e4cbd1943e2526e3527d58a19b)
ext/json11/json11.cpp
pdns/webserver.cc
regression-tests.api/test_Servers.py