qemu/tests/libqos
Markus Armbruster 015715f554 tests: Clean up string interpolation into QMP input (simple cases)
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>
2018-08-16 08:42:06 +02:00
..
ahci.c libqtest: Rename functions to send QMP messages 2018-08-16 08:42:06 +02:00
ahci.h ahci: fix FIS I bit and PIO Setup FIS interrupt 2018-06-25 16:50:48 -04:00
fw_cfg.c
fw_cfg.h
i2c-imx.c
i2c-omap.c
i2c.c
i2c.h misc: add pca9552 LED blinker model 2018-06-08 13:15:32 +01:00
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 tests: Clean up string interpolation into QMP input (simple cases) 2018-08-16 08:42:06 +02:00
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