virDomainAudioOSSParse: Use virXMLProp*
This strictens the parser to disallow negative values (interpreted as `UINT_MAX + value + 1`) for attribute `bufferCount`. Allowing negative numbers to be interpreted this way makes no sense for this attribute. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
23e763eb46
commit
cd4c756fd5
@ -13074,26 +13074,15 @@ static int
|
|||||||
virDomainAudioOSSParse(virDomainAudioIOOSS *def,
|
virDomainAudioOSSParse(virDomainAudioIOOSS *def,
|
||||||
xmlNodePtr node)
|
xmlNodePtr node)
|
||||||
{
|
{
|
||||||
g_autofree char *tryPoll = virXMLPropString(node, "tryPoll");
|
|
||||||
g_autofree char *bufferCount = virXMLPropString(node, "bufferCount");
|
|
||||||
|
|
||||||
def->dev = virXMLPropString(node, "dev");
|
def->dev = virXMLPropString(node, "dev");
|
||||||
|
|
||||||
if (tryPoll &&
|
if (virXMLPropTristateBool(node, "tryPoll", VIR_XML_PROP_NONE,
|
||||||
((def->tryPoll =
|
&def->tryPoll) < 0)
|
||||||
virTristateBoolTypeFromString(tryPoll)) <= 0)) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
|
||||||
_("unknown 'tryPoll' value '%s'"), tryPoll);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (bufferCount &&
|
if (virXMLPropUInt(node, "bufferCount", 10, VIR_XML_PROP_NONE,
|
||||||
virStrToLong_ui(bufferCount, NULL, 10,
|
&def->bufferCount) < 0)
|
||||||
&def->bufferCount) < 0) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
|
||||||
_("cannot parse 'bufferCount' value '%s'"), bufferCount);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user