diff options
author | Thomas Huth <thuth@redhat.com> | 2024-10-15 13:25:10 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-10-21 22:40:47 +0300 |
commit | 30b1fc5a9820c7d8db273afd0c87f093f2857f9f (patch) | |
tree | 66db41f05fe72569880ecd1fb04f18d19d59889d /ui | |
parent | fe71f4b0deeaf14291a047d87b13e1133e355314 (diff) | |
download | qemu-30b1fc5a9820c7d8db273afd0c87f093f2857f9f.zip qemu-30b1fc5a9820c7d8db273afd0c87f093f2857f9f.tar.gz qemu-30b1fc5a9820c7d8db273afd0c87f093f2857f9f.tar.bz2 |
ui/console-vc: Silence warning about sprintf() on OpenBSD
The linker on OpenBSD complains:
ld: warning: console-vc.c:824 (../src/ui/console-vc.c:824)([...]):
warning: sprintf() is often misused, please use snprintf()
Using g_strdup_printf() is certainly better here, so let's switch
to that function instead.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/console-vc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/console-vc.c b/ui/console-vc.c index 8393d53..53fcee8 100644 --- a/ui/console-vc.c +++ b/ui/console-vc.c @@ -648,7 +648,7 @@ static void vc_putchar(VCChardev *vc, int ch) QemuTextConsole *s = vc->console; int i; int x, y; - char response[40]; + g_autofree char *response = NULL; switch(vc->state) { case TTY_STATE_NORM: @@ -821,7 +821,7 @@ static void vc_putchar(VCChardev *vc, int ch) break; case 6: /* report cursor position */ - sprintf(response, "\033[%d;%dR", + response = g_strdup_printf("\033[%d;%dR", (s->y_base + s->y) % s->total_height + 1, s->x + 1); vc_respond_str(vc, response); |