Commit fc0ad97b authored by Sébastien Blin's avatar Sébastien Blin
Browse files

avmodel: avoid heap-buffer-overflow

use finished string to avoid a heap-buffer-overflow due to non
terminated string

Change-Id: Ic7d7fd45522e199977be9213359888b630d86543
parent 70a89500
......@@ -602,11 +602,12 @@ AVModel::getListWindows() const
free(e);
}
if (replyProp.get()) {
int valueLegth2 = xcb_get_property_value_length(replyProp.get());
if (valueLegth2) {
auto name = QString::fromUtf8(
reinterpret_cast<char*>(xcb_get_property_value(replyProp.get())));
name.truncate(valueLegth2);
int v_size = xcb_get_property_value_length(replyProp.get());
if (v_size) {
auto v = std::string(reinterpret_cast<char*>(
xcb_get_property_value(replyProp.get())),
v_size);
auto name = QString::fromUtf8(v.c_str());
if (ret.find(name) != ret.end())
name += QString(" - 0x%1").arg(win[i], 0, 16);
ret.insert(name, QVariant(QString("0x%1").arg(win[i], 0, 16)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment