From: Pierre Ossman Date: Mon, 20 May 2024 08:44:41 +0000 (+0200) Subject: Don't check pointers for zero length buffers X-Git-Tag: v1.13.90~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=763cf8b27cb79e97bb2e5edefbc5bdce9bd6b6f7;p=tigervnc.git Don't check pointers for zero length buffers It's perfectly fine to give a NULL pointer if the length has explicitly been specified as zero. --- diff --git a/common/rfb/obfuscate.cxx b/common/rfb/obfuscate.cxx index 1f785893..d40e25c3 100644 --- a/common/rfb/obfuscate.cxx +++ b/common/rfb/obfuscate.cxx @@ -56,11 +56,11 @@ std::string rfb::deobfuscate(const uint8_t *data, size_t len) { char buf[9]; - assert(data != NULL); - if (len != 8) throw rdr::Exception("bad obfuscated password length"); + assert(data != NULL); + deskey(d3desObfuscationKey, DE1); des((uint8_t*)data, (uint8_t*)buf); buf[8] = 0; diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index d1a8cc33..48f59846 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -126,8 +126,8 @@ namespace rfb { bool hexToBin(const char* in, size_t inlen, uint8_t* out, size_t outlen) { - assert(in); - assert(out); + assert(in || inlen == 0); + assert(out || outlen == 0); if (inlen & 1) return false;