Hello everyone!
When implementing some custom qemu capability I cought this bug when
some string with '*' pattern is not contained in schema, and
virQEMUQAPISchemaTraverseObject
passes NULL ptr to virJSONValueObjectHasKey.
Nikolai Barybin (1):
qemu: qapi: fix potential SIGSEGV in virQEMUQAPISchemaTraverseObject()
src/qemu/qemu_qapi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.43.5
Show replies by date
We need to check obj ptr before passing it to
virJSONValueObjectHasKey(). If it's NULL it will fail with SIGSEGV.
Signed-off-by: Nikolai Barybin <nikolai.barybin(a)virtuozzo.com>
---
src/qemu/qemu_qapi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_qapi.c b/src/qemu/qemu_qapi.c
index 184c0a965f..a2fef55019 100644
--- a/src/qemu/qemu_qapi.c
+++ b/src/qemu/qemu_qapi.c
@@ -180,7 +180,7 @@ virQEMUQAPISchemaTraverseObject(virJSONValue *cur,
} else {
obj = virQEMUQAPISchemaObjectGet("members", query, "name",
cur);
- if (modifier == '*' &&
+ if (modifier == '*' && obj &&
!virJSONValueObjectHasKey(obj, "default"))
return 0;
}
--
2.43.5