summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-12-19 14:05:43 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-12-19 14:05:43 +0000
commit4fd37a98d1248bae54a9f71ee1c252d2b2f1efd5 (patch)
tree659ca9cb1828582d1a75695c416de2c6a594bac5 /vl.c
parentd41160a3e64b26c9d78ecfd78b0e7ef3e878d475 (diff)
downloadqemu-4fd37a98d1248bae54a9f71ee1c252d2b2f1efd5.tar.gz
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 <blauwirbel@gmail.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index c4d3fc0d3d..768dbf48ad 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;