summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;