]> source.dussan.org Git - tigervnc.git/commitdiff
Remove OutStream::skip()
authorPierre Ossman <ossman@cendio.se>
Fri, 15 May 2020 21:33:02 +0000 (23:33 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 21 May 2020 09:34:22 +0000 (11:34 +0200)
It might leak data depending on what's in the buffer. Use pad() instead
where blank space is needed.

common/rdr/OutStream.h
common/rfb/CMsgWriter.cxx

index 0f60ccc19cf7fd469eace5cd42395b7ae19d735c..6e9069c670a4115518b37c61bda0686c21f79287 100644 (file)
@@ -83,14 +83,6 @@ namespace rdr {
       while (bytes-- > 0) writeU8(0);
     }
 
-    inline void skip(size_t bytes) {
-      while (bytes > 0) {
-        size_t n = check(1, bytes);
-        ptr += n;
-        bytes -= n;
-      }
-    }
-
     // writeBytes() writes an exact number of bytes.
 
     void writeBytes(const void* data, size_t length) {
index 3180391b2e36442f613e54dd01fe09cc4ec19210..c452f5eb88edb49e89b8ca1379e9ac4337e81ab7 100644 (file)
@@ -61,7 +61,7 @@ void CMsgWriter::writeSetEncodings(const std::list<rdr::U32> encodings)
 {
   std::list<rdr::U32>::const_iterator iter;
   startMsg(msgTypeSetEncodings);
-  os->skip(1);
+  os->pad(1);
   os->writeU16(encodings.size());
   for (iter = encodings.begin(); iter != encodings.end(); ++iter)
     os->writeU32(*iter);