提交 4fd37a98 编写于 作者: B Blue Swirl

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: NBlue Swirl <blauwirbel@gmail.com>
上级 d41160a3
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册