diff --git a/synergy/CClipboard.cpp b/synergy/CClipboard.cpp index 8862d769..56a2d41a 100644 --- a/synergy/CClipboard.cpp +++ b/synergy/CClipboard.cpp @@ -146,9 +146,13 @@ CClipboard::unmarshall(const CString& data, Time time) UInt32 size = readUInt32(index); index += 4; - // save the data - m_added[format] = true; - m_data[format] = CString(index, size); + // save the data if it's a known format. if either the client + // or server supports more clipboard formats than the other + // then one of them will get a format >= kNumFormats here. + if (format < static_cast(IClipboard::kNumFormats)) { + m_added[format] = true; + m_data[format] = CString(index, size); + } index += size; } diff --git a/synergy/IClipboard.h b/synergy/IClipboard.h index 2c145315..cd56d9e2 100644 --- a/synergy/IClipboard.h +++ b/synergy/IClipboard.h @@ -17,9 +17,9 @@ public: // data set via add() and retrieved via get() is in one of // these formats. platform dependent clipboard subclasses // can and should present any suitable formats derivable - // from these formats (e.g. UCS-16 encoded unicode). + // from these formats (e.g. UTF-16 encoded unicode). // - // kText: UTF-8 encoded unicode (ISO-10646), newline is LF + // kText: UTF-8 encoded unicode (ISO-10646), newline is LF. enum EFormat { kText, kNumFormats }; // manipulators