[libvirt PATCH 10/10] virDomainAudioSDLParse: Use virXMLProp*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `bufferCount`.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 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 bff17057af..12bdc12f54 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13455,15 +13455,9 @@ static int
 virDomainAudioSDLParse(virDomainAudioIOSDL *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;
 }
-- 
2.26.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux