add missing checks in motif to prevent leaking image data to text targets

This commit is contained in:
draekko 2023-02-21 05:11:59 -05:00
parent 52046298a6
commit 9c41922b33
1 changed files with 16 additions and 0 deletions

View File

@ -838,6 +838,22 @@ XWindowsClipboard::motifFillCache()
continue;
}
if (actualTarget != target) {
LOG((CLOG_DEBUG1 " target %s not same as actual target %s",
XWindowsUtil::atomToString(m_display, target).c_str(),
XWindowsUtil::atomToString(m_display, actualTarget).c_str()));
m_added[format] = false;
continue;
}
if (targetData.empty()) {
m_added[format] = false;
LOG((CLOG_DEBUG1 " no targetdata for target %s (actual target %s)",
XWindowsUtil::atomToString(m_display, target).c_str(),
XWindowsUtil::atomToString(m_display, actualTarget).c_str()));
continue;
}
if (!converter->toIClipboard(targetData).empty()) {
// add to clipboard and note we've done it
m_data[format] = converter->toIClipboard(targetData);