[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 08/22] qtest: Avoid passing raw strings through h
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v4 08/22] qtest: Avoid passing raw strings through hmp() |
Date: |
Thu, 3 Aug 2017 20:25:37 -0500 |
The next patch will add __attribute__((__format__)) to hmp(), which
in turn causes gcc to warn about non-literal format strings. Rather
than risk an arbitrary string containing % being mis-handled, always
pass variable strings along with a %s format. It also makes it
easier to prove correctness locally, rather than auditing all the
source strings.
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
tests/test-hmp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 729c0339f7..4aadd6a432 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -80,7 +80,7 @@ static void test_commands(void)
if (verbose) {
fprintf(stderr, "\t%s\n", hmp_cmds[i]);
}
- response = hmp(hmp_cmds[i]);
+ response = hmp("%s", hmp_cmds[i]);
g_free(response);
}
@@ -103,7 +103,7 @@ static void test_info_commands(void)
if (verbose) {
fprintf(stderr, "\t%s\n", info);
}
- resp = hmp(info);
+ resp = hmp("%s", info);
g_free(resp);
/* And move forward to the next line */
info = strchr(endp + 1, '\n');
--
2.13.3
- [Qemu-devel] [PATCH v4 00/22] Clean up around qmp() and hmp(), Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 01/22] qobject: Accept "%"PRId64 in qobject_from_jsonf(), Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 02/22] tests: Clean up wait for event, Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 03/22] tests/libqtest: Clean up how we read the QMP greeting, Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 04/22] tests: Add assertion for no qmp(""), Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 07/22] numa-test: Use hmp(), Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 08/22] qtest: Avoid passing raw strings through hmp(),
Eric Blake <=
- [Qemu-devel] [PATCH v4 09/22] qtest: Document calling conventions, Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 06/22] qobject: Perform %% interpolation in qobject_from_jsonf(), Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 10/22] libqtest: Skip round-trip through QObject, Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 05/22] qobject: Simplify qobject_from_jsonv(), Eric Blake, 2017/08/03
- [Qemu-devel] [PATCH v4 12/22] libqtest: Change qmp_fd_send() to drop varargs, Eric Blake, 2017/08/03