mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virDomainAudioPulseAudioParse: Use virXMLProp*
This strictens the parser to disallow negative values (interpreted as `UINT_MAX + value + 1`) for attribute `latency`. Allowing negative numbers to be interpreted this way makes no sense for this attribute. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
667dea5a1e
commit
15670ebb17
@ -13092,18 +13092,12 @@ static int
|
||||
virDomainAudioPulseAudioParse(virDomainAudioIOPulseAudio *def,
|
||||
xmlNodePtr node)
|
||||
{
|
||||
g_autofree char *latency = virXMLPropString(node, "latency");
|
||||
|
||||
def->name = virXMLPropString(node, "name");
|
||||
def->streamName = virXMLPropString(node, "streamName");
|
||||
|
||||
if (latency &&
|
||||
virStrToLong_ui(latency, NULL, 10,
|
||||
&def->latency) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("cannot parse 'latency' value '%s'"), latency);
|
||||
if (virXMLPropUInt(node, "latency", 10, VIR_XML_PROP_NONE,
|
||||
&def->latency) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user