]> git.ipfire.org Git - thirdparty/pdns.git/commit
Properly encode json string containing binary data 12344/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 2 Dec 2022 08:16:55 +0000 (09:16 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 20 Dec 2022 08:34:48 +0000 (09:34 +0100)
commitb9f4fadba519251f49461f3c2563fe8f21b19c0e
treefeaa7c5d0e89767176705082a8a9886f351e149b
parent84bc8944539bb9082312c703fb19775ffabc79f9
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