diff options
-rw-r--r-- | vl.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; |