From dc38699af81e8bb953946000121f0a48cf30b962 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 15 May 2020 23:33:02 +0200 Subject: [PATCH] Remove OutStream::skip() It might leak data depending on what's in the buffer. Use pad() instead where blank space is needed. --- common/rdr/OutStream.h | 8 -------- common/rfb/CMsgWriter.cxx | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) 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); -- 2.39.5