Fix OpenBSD linker warning

Fix a warning from OpenBSD linker:
../libhw32/vl.o(.text+0x5c3c): In function `main':
/src/qemu/vl.c:2335: warning: sprintf() is often misused, please use snprintf()

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Blue Swirl 2010-08-31 20:16:59 +00:00
parent d729bb9a77
commit cb93bbdd7d

6
vl.c
View File

@ -2332,7 +2332,8 @@ int main(int argc, char **argv, char **envp)
len += strlen(qemu_opt_get(opts, "security_model"));
arg_fsdev = qemu_malloc((len + 1) * sizeof(*arg_fsdev));
sprintf(arg_fsdev, "%s,id=%s,path=%s,security_model=%s",
snprintf(arg_fsdev, len * sizeof(*arg_fsdev),
"%s,id=%s,path=%s,security_model=%s",
qemu_opt_get(opts, "fstype"),
qemu_opt_get(opts, "mount_tag"),
qemu_opt_get(opts, "path"),
@ -2342,7 +2343,8 @@ int main(int argc, char **argv, char **envp)
len += 2*strlen(qemu_opt_get(opts, "mount_tag"));
arg_9p = qemu_malloc((len + 1) * sizeof(*arg_9p));
sprintf(arg_9p, "virtio-9p-pci,fsdev=%s,mount_tag=%s",
snprintf(arg_9p, len * sizeof(*arg_9p),
"virtio-9p-pci,fsdev=%s,mount_tag=%s",
qemu_opt_get(opts, "mount_tag"),
qemu_opt_get(opts, "mount_tag"));