fix(clipboard): check oob for clipboard before reading number of formats

This commit is contained in:
sithlord48 2026-08-27 08:15:29 -04:00 committed by Chris Rizzitello
parent fdc61ac3cd
commit e3f42ed398

View file

@ -27,13 +27,13 @@ void IClipboard::unmarshall(IClipboard *clipboard, const std::string_view &data,
// clear existing data // clear existing data
clipboard->empty(); clipboard->empty();
// read the number of formats
const uint32_t numFormats = readUInt32(index);
if (end - index < 4) { if (end - index < 4) {
LOG_ERR("clipboard unmarshall: truncated header"); LOG_ERR("clipboard unmarshall: truncated header");
clipboard->close(); clipboard->close();
return; return;
} }
// read the number of formats
const uint32_t numFormats = readUInt32(index);
index += 4; index += 4;
// read each format // read each format