From 23e763eb46271a211de300a910aa779cd3a2b22d Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Tue, 18 May 2021 17:04:49 +0200 Subject: [PATCH] virDomainAudioCoreAudioParse: 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 Reviewed-by: Laine Stump --- src/conf/domain_conf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 57a54f12ef..a46e64c64a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13046,15 +13046,9 @@ static int virDomainAudioCoreAudioParse(virDomainAudioIOCoreAudio *def, xmlNodePtr node) { - g_autofree char *bufferCount = virXMLPropString(node, "bufferCount"); - - if (bufferCount && - virStrToLong_ui(bufferCount, NULL, 10, - &def->bufferCount) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse 'bufferCount' value '%s'"), bufferCount); + if (virXMLPropUInt(node, "bufferCount", 10, VIR_XML_PROP_NONE, + &def->bufferCount) < 0) return -1; - } return 0; }