mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
015715f554
When you build QMP input manually like this cmd = g_strdup_printf("{ 'execute': 'migrate'," "'arguments': { 'uri': '%s' } }", uri); rsp = qmp(cmd); g_free(cmd); you're responsible for escaping the interpolated values for JSON. Not done here, and therefore works only for sufficiently nice @uri. For instance, if @uri contained a single "'", qobject_from_vjsonf_nofail() would abort. A sufficiently nasty @uri could even inject unwanted members into the arguments object. Leaving interpolation into JSON to qmp() is more robust: rsp = qmp("{ 'execute': 'migrate', 'arguments': { 'uri': %s } }", uri); It's also more concise. Clean up the simple cases where we interpolate exactly a JSON value. Bonus: gets rid of non-literal format strings. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180806065344.7103-13-armbru@redhat.com> |
||
---|---|---|
.. | ||
ahci.c | ||
ahci.h | ||
fw_cfg.c | ||
fw_cfg.h | ||
i2c-imx.c | ||
i2c-omap.c | ||
i2c.c | ||
i2c.h | ||
libqos-pc.c | ||
libqos-pc.h | ||
libqos-spapr.c | ||
libqos-spapr.h | ||
libqos.c | ||
libqos.h | ||
malloc-generic.c | ||
malloc-generic.h | ||
malloc-pc.c | ||
malloc-pc.h | ||
malloc-spapr.c | ||
malloc-spapr.h | ||
malloc.c | ||
malloc.h | ||
pci-pc.c | ||
pci-pc.h | ||
pci-spapr.c | ||
pci-spapr.h | ||
pci.c | ||
pci.h | ||
rtas.c | ||
rtas.h | ||
usb.c | ||
usb.h | ||
virtio-mmio.c | ||
virtio-mmio.h | ||
virtio-pci.c | ||
virtio-pci.h | ||
virtio.c | ||
virtio.h |