[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/5] qapi: Check for negative enum values
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 1/5] qapi: Check for negative enum values |
Date: |
Thu, 17 Nov 2011 15:18:17 -0200 |
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 <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
qapi/qmp-output-visitor.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index d67724e..f76d015 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;
}
--
1.7.8.rc2.3.g0911
- [Qemu-devel] [PULL 0/5]: QMP patches for 1.0, Luiz Capitulino, 2011/11/17
- [Qemu-devel] [PATCH 1/5] qapi: Check for negative enum values,
Luiz Capitulino <=
- [Qemu-devel] [PATCH 2/5] Makefile: remove more generated files on clean, Luiz Capitulino, 2011/11/17
- [Qemu-devel] [PATCH 3/5] Makefile: fix dependencies for generated .h, .c, Luiz Capitulino, 2011/11/17
- [Qemu-devel] [PATCH 4/5] Makefile: dependency fix, Luiz Capitulino, 2011/11/17
- [Qemu-devel] [PATCH 5/5] Makefile: fix qga dependencies, Luiz Capitulino, 2011/11/17
- Re: [Qemu-devel] [PULL 0/5]: QMP patches for 1.0, Anthony Liguori, 2011/11/21