summaryrefslogtreecommitdiffstats
path: root/qapi
diff options
context:
space:
mode:
authorLuiz Capitulino2011-11-14 14:25:09 +0100
committerLuiz Capitulino2011-11-17 18:15:03 +0100
commit54d50be688aba80e0fd5ba53f23a074a0ce2e381 (patch)
tree399651a6203a4c93ecd6eca56d4ca199a109bba1 /qapi
parentUpdate version to 1.0-rc2 (diff)
downloadqemu-54d50be688aba80e0fd5ba53f23a074a0ce2e381.tar.gz
qemu-54d50be688aba80e0fd5ba53f23a074a0ce2e381.tar.xz
qemu-54d50be688aba80e0fd5ba53f23a074a0ce2e381.zip
qapi: Check for negative enum values
We don't currently check for negative enum values in qmp_output_type_enum(), this will very likely generate a segfault when triggered. However, it _seems_ that no code in tree can trigger this today. Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qmp-output-visitor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index d67724ea4b..f76d0159cd 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -190,7 +190,7 @@ static void qmp_output_type_enum(Visitor *v, int *obj, const char *strings[],
assert(strings);
while (strings[i++] != NULL);
- if (value >= i - 1) {
+ if (value < 0 || value >= i - 1) {
error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null");
return;
}