Ignore non-ASCII keys in zeroconf payloads (#34344)

* Ignore non-ASCII keys in zeroconf payloads

* Don't rely on logging for test
This commit is contained in:
jjlawren authored and GitHub committed 2020-04-17 19:36:46 -05:00
1 parent 2faa3af51f
commit 82784a320c
2 files changed
+21 -4

No files matched your search

@@ -157,7 +157,14 @@ def info_from_service(service):
# See https://ietf.org/rfc/rfc6763.html#section-6.4 and
# https://ietf.org/rfc/rfc6763.html#section-6.5 for expected encodings
# for property keys and values
key = key.decode("ascii")
try:
key = key.decode("ascii")
except UnicodeDecodeError:
_LOGGER.debug(
"Ignoring invalid key provided by [%s]: %s", service.name, key
)
continue
properties["_raw"][key] = value
try: