提交 5102d2c2 编写于 作者: J Ján Tomko

Strip control characters from sysfs attributes

Including them in the XML makes them unparsable.

https://bugzilla.redhat.com/show_bug.cgi?id=1184131
(cherry picked from commit 55710750)
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 0af5db8e
......@@ -198,7 +198,9 @@ static int udevGetUintProperty(struct udev_device *udev_device,
/* This function allocates memory from the heap for the property
* value. That memory must be later freed by some other code. */
* value. That memory must be later freed by some other code.
* Any control characters that cannot be printed in the XML are stripped
* from the string */
static int udevGetDeviceSysfsAttr(struct udev_device *udev_device,
const char *attr_name,
char **attr_value)
......@@ -243,6 +245,8 @@ static int udevGetStringSysfsAttr(struct udev_device *udev_device,
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &tmp);
virStringStripControlChars(tmp);
if (tmp != NULL && (STREQ(tmp, ""))) {
VIR_FREE(tmp);
tmp = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册