From 84cf8b584076f4b5635a4ce7d2be3ee67fe0f73b Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 8 May 2025 17:43:01 +0000 Subject: [PATCH] Avoid UnicodeDecodeError when reading nmap output. See #3087 --- zenmap/zenmapCore/NmapCommand.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zenmap/zenmapCore/NmapCommand.py b/zenmap/zenmapCore/NmapCommand.py index 3fe98d7c1..19b4982c7 100644 --- a/zenmap/zenmapCore/NmapCommand.py +++ b/zenmap/zenmapCore/NmapCommand.py @@ -198,7 +198,8 @@ class NmapCommand(object): # We don't need a file name for stdout output, just a handle. A # TemporaryFile is deleted as soon as it is closed, and in Unix is # unlinked immediately after creation so it's not even visible. - f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8") + f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8", + errors='backslashreplace') self.stdout_file = f if stderr is None: stderr = f