aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2020-05-15 23:33:02 +0200
committerPierre Ossman <ossman@cendio.se>2020-05-21 11:34:22 +0200
commitdc38699af81e8bb953946000121f0a48cf30b962 (patch)
tree150d4d635a370a6a2aed869d8aa9226c6b3da298
parent5e875ba492944b80ad43cd4fbdedd2a6d2fd56d0 (diff)
downloadtigervnc-dc38699af81e8bb953946000121f0a48cf30b962.tar.gz
tigervnc-dc38699af81e8bb953946000121f0a48cf30b962.zip
Remove OutStream::skip()
It might leak data depending on what's in the buffer. Use pad() instead where blank space is needed.
-rw-r--r--common/rdr/OutStream.h8
-rw-r--r--common/rfb/CMsgWriter.cxx2
2 files changed, 1 insertions, 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<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);