mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 16:15:19 +00:00
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 557107500b22d4a5ba7d1b09f5f516512dfca67b)
This commit is contained in:
parent
20674276cf
commit
89b8dd650f
@ -194,7 +194,9 @@ static int udevGetUintProperty(struct udev_device *udev_device,
|
|||||||
|
|
||||||
|
|
||||||
/* This function allocates memory from the heap for the property
|
/* 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,
|
static int udevGetDeviceSysfsAttr(struct udev_device *udev_device,
|
||||||
const char *attr_name,
|
const char *attr_name,
|
||||||
char **attr_value)
|
char **attr_value)
|
||||||
@ -239,6 +241,8 @@ static int udevGetStringSysfsAttr(struct udev_device *udev_device,
|
|||||||
|
|
||||||
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &tmp);
|
ret = udevGetDeviceSysfsAttr(udev_device, attr_name, &tmp);
|
||||||
|
|
||||||
|
virStringStripControlChars(tmp);
|
||||||
|
|
||||||
if (tmp != NULL && (STREQ(tmp, ""))) {
|
if (tmp != NULL && (STREQ(tmp, ""))) {
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user