From: Pierre Ossman Date: Sat, 4 Feb 2023 12:07:04 +0000 (+0100) Subject: Make sure length is reset on assignment X-Git-Tag: v1.13.90~87^2~29 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cee09051e685e952b948cafab2d4ccdb9ab11f07;p=tigervnc.git 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. --- 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];