diff options
| author | Eric Blake | 2017-09-11 19:20:14 +0200 |
|---|---|---|
| committer | Thomas Huth | 2017-09-15 09:05:19 +0200 |
| commit | 7b899f4dd596dbb7d271f7fab36fbfffec84868e (patch) | |
| tree | 2cc98be4af927083e26c8d40b25d93694eb8cf07 /tests/test-hmp.c | |
| parent | libqtest: Remove dead qtest_instances variable (diff) | |
| download | qemu-7b899f4dd596dbb7d271f7fab36fbfffec84868e.tar.gz qemu-7b899f4dd596dbb7d271f7fab36fbfffec84868e.tar.xz qemu-7b899f4dd596dbb7d271f7fab36fbfffec84868e.zip | |
qtest: Avoid passing raw strings through hmp()
hmp() passes its string argument through the sprintf() family;
with a proper attribute, gcc -Wformat warns us when we do something
dangerous like passing a non-constant format string. Fortunately,
all our strings were safe, but checking whether the string can
contain an unintended % is easy to avoid and therefore worth doing.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/test-hmp.c')
| -rw-r--r-- | tests/test-hmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test-hmp.c b/tests/test-hmp.c index 4156d6111b..5677fbf775 100644 --- a/tests/test-hmp.c +++ b/tests/test-hmp.c @@ -81,7 +81,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); } @@ -104,7 +104,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'); |
