cut spurious \0 byte from string properties

added with 26c263cc1de9cf0af66c12d0d746cd8ae7b1744a

CCBUG: 326893
FIXED-IN: 4.11.6
REVIEW: 114963
icc-effect-5.14.5
Thomas Lübking 2014-01-11 12:50:08 +01:00
parent edf0ed895f
commit 5032520920
1 changed files with 4 additions and 1 deletions

View File

@ -129,14 +129,17 @@ QByteArray getStringProperty(xcb_window_t w, xcb_atom_t prop, char separator)
return QByteArray();
}
char *data = static_cast<char*>(xcb_get_property_value(property.data()));
int length = property->value_len;
if (data && separator) {
for (uint32_t i = 0; i < property->value_len; ++i) {
if (!data[i] && i + 1 < property->value_len) {
data[i] = separator;
} else {
length = i;
}
}
}
return QByteArray(data, property->value_len);
return QByteArray(data, length);
}
#ifndef KCMRULES