From cee09051e685e952b948cafab2d4ccdb9ab11f07 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 4 Feb 2023 13:07:04 +0100 Subject: [PATCH] Make sure length is reset on assignment Otherwise the old length is preserved, which will result in NULL pointer dereferencing if the parameter is ever accessed. --- common/rfb/Configuration.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx index c2f59d86..4b376168 100644 --- a/common/rfb/Configuration.cxx +++ b/common/rfb/Configuration.cxx @@ -456,7 +456,9 @@ void BinaryParameter::setParam(const uint8_t* v, size_t len) { LOCK_CONFIG; if (immutable) return; vlog.debug("set %s(Binary)", getName()); - delete [] value; value = 0; + delete [] value; + value = NULL; + length = 0; if (len) { assert(v); value = new uint8_t[len]; -- 2.39.5