Suggested-by: Paolo Bonzini <[email protected]>
CC: Markus Armbruster <[email protected]>
CC: Kevin Wolf <[email protected]>
CC: [email protected]
Signed-off-by: Peter Xu <[email protected]>
---
block/qapi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/qapi.c b/block/qapi.c
index db2d3fb..687e577 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -638,9 +638,12 @@ static void dump_qdict(fprintf_function func_fprintf, void
*f, int indentation,
QType type = qobject_type(entry->value);
bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
const char *format = composite ? "%*s%s:\n" : "%*s%s: ";
- char key[strlen(entry->key) + 1];
+#define __KEY_LEN (256)
+ char key[__KEY_LEN];
int i;
+ assert(strlen(entry->key) + 1 <= __KEY_LEN);
+#undef __KEY_LEN
/* replace dashes with spaces in key (variable) names */
for (i = 0; entry->key[i]; i++) {
key[i] = entry->key[i] == '-' ? ' ' : entry->key[i];
--
2.4.3