]> source.dussan.org Git - tigervnc.git/commitdiff
Make sure length is reset on assignment
authorPierre Ossman <ossman@cendio.se>
Sat, 4 Feb 2023 12:07:04 +0000 (13:07 +0100)
committerPierre Ossman <ossman@cendio.se>
Sat, 4 Feb 2023 13:03:13 +0000 (14:03 +0100)
Otherwise the old length is preserved, which will result in NULL pointer
dereferencing if the parameter is ever accessed.

common/rfb/Configuration.cxx

index c2f59d86fd7d22a261b0d6c091f959c241644f72..4b376168d06495966cadd0a0819eb3703b9e6429 100644 (file)
@@ -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];