From: Blue Swirl Date: Sun, 19 Dec 2010 14:05:43 +0000 (+0000) Subject: Avoid a warning from OpenBSD linker X-Git-Tag: TizenStudio_2.0_p2.3~3761 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=082440a1004253a05b44fcb621b53fa82778b408;p=sdk%2Femulator%2Fqemu.git Avoid a warning from OpenBSD linker Avoid the warning below by using snprintf: ../libhw64/vl.o(.text+0x78d4): In function `get_boot_devices_list': /src/qemu/vl.c:763: warning: sprintf() is often misused, please use snprintf() Signed-off-by: Blue Swirl --- diff --git a/vl.c b/vl.c index c4d3fc0..768dbf4 100644 --- a/vl.c +++ b/vl.c @@ -759,8 +759,10 @@ char *get_boot_devices_list(uint32_t *size) } if (i->suffix && devpath) { - bootpath = qemu_malloc(strlen(devpath) + strlen(i->suffix) + 1); - sprintf(bootpath, "%s%s", devpath, i->suffix); + size_t bootpathlen = strlen(devpath) + strlen(i->suffix) + 1; + + bootpath = qemu_malloc(bootpathlen); + snprintf(bootpath, bootpathlen, "%s%s", devpath, i->suffix); qemu_free(devpath); } else if (devpath) { bootpath = devpath;