summaryrefslogtreecommitdiff
path: root/qapi/qmp-output-visitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'qapi/qmp-output-visitor.c')
-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;
}