From: Pierre Ossman Date: Fri, 15 May 2020 21:33:02 +0000 (+0200) Subject: Remove OutStream::skip() X-Git-Tag: v1.11.90~74^2~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dc38699af81e8bb953946000121f0a48cf30b962;p=tigervnc.git Remove OutStream::skip() It might leak data depending on what's in the buffer. Use pad() instead where blank space is needed. --- diff --git a/common/rdr/OutStream.h b/common/rdr/OutStream.h index 0f60ccc1..6e9069c6 100644 --- a/common/rdr/OutStream.h +++ b/common/rdr/OutStream.h @@ -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) { diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx index 3180391b..c452f5eb 100644 --- a/common/rfb/CMsgWriter.cxx +++ b/common/rfb/CMsgWriter.cxx @@ -61,7 +61,7 @@ void CMsgWriter::writeSetEncodings(const std::list encodings) { std::list::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);