mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
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>
This commit is contained in:
parent
4fb609adc9
commit
7b899f4dd5
2 changed files with 6 additions and 6 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue