From 35b739685fbb2fff450df765db9daaf7ef287cc9 Mon Sep 17 00:00:00 2001 From: db0 Date: Sun, 10 Mar 2024 00:07:41 +0100 Subject: [PATCH] fix: Avoid trying to store NUL char in DB --- horde/classes/base/processing_generation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/horde/classes/base/processing_generation.py b/horde/classes/base/processing_generation.py index 87adf0db..7a8b70c8 100644 --- a/horde/classes/base/processing_generation.py +++ b/horde/classes/base/processing_generation.py @@ -84,7 +84,8 @@ def set_generation(self, generation, things_per_sec, **kwargs): # We return -1 to know to send a different error if self.is_faulted(): return -1 - self.generation = generation + # Sanitize NUL char away from string literal we store in the DB + self.generation = generation.replace("\x00", "\uFFFD") # Support for two typical properties self.seed = kwargs.get("seed", None) self.gen_metadata = kwargs.get("gen_metadata", None)