mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-23 20:12:39 +03:00
no longer attempting to unmarshall clipboard formats that aren't
known to the caller. if the client supports more formats than the server then the server could get a clipboard format greater than kNumFormats. with this change the server discards the extra formats instead of crashing.
This commit is contained in:
parent
8ada1e8a72
commit
57b64f1fe7
@ -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<UInt32>(IClipboard::kNumFormats)) {
|
||||
m_added[format] = true;
|
||||
m_data[format] = CString(index, size);
|
||||
}
|
||||
index += size;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user