[PATCH] util: typedparam: Fix sentinel handling in template validator

Yaroslav Borbat posted 1 patch 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20260515191359.2462604-1-yaroslav.752@gmail.com
src/util/virtypedparam.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] util: typedparam: Fix sentinel handling in template validator
Posted by Yaroslav Borbat 2 weeks ago
From: Yaroslav Borbat <yaroslav.752@gmail.com>

virTypedParamsValidateTemplate() iterated templates with
  an inverted sentinel condition and counted entries incorrectly.

  This caused valid params to be rejected as unsupported, e.g.
  migration parameter 'disks_uri'.

  Fixes: a650af5002a7477cab649c44fff58bbbc909b8a8

Signed-off-by: Yaroslav Borbat <yaroslav.752@gmail.com>
---
 src/util/virtypedparam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index 92f25cea39..530136978b 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -213,7 +213,7 @@ virTypedParamsValidateTemplate(virTypedParameterPtr params,

     /* we need to copy the list of templates because
      * 'virTypedParamsValidateInternal' will need to sort it */
-    while (*templates[ntemplates++].name == '\0')
+    while (*templates[ntemplates++].name != '\0')
         ;

     templ_copy = g_new0(virTypedParamValidationTemplate, ntemplates);
--
2.54.0