mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
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>
This commit is contained in:
parent
3f5bd4e1b8
commit
54d50be688
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue