diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2010-08-31 20:16:59 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-08-31 20:16:59 +0000 |
commit | cb93bbdd7db92e50ff5e60a346b23df68acae46b (patch) | |
tree | bde1a3bfe3b73ad3fcd89290f05024f6002e6e5d /vl.c | |
parent | d729bb9a7700e364b1c5f9893d61f07a9e002bce (diff) | |
download | hqemu-cb93bbdd7db92e50ff5e60a346b23df68acae46b.zip hqemu-cb93bbdd7db92e50ff5e60a346b23df68acae46b.tar.gz |
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>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -2332,19 +2332,21 @@ 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", - qemu_opt_get(opts, "fstype"), - qemu_opt_get(opts, "mount_tag"), - qemu_opt_get(opts, "path"), - qemu_opt_get(opts, "security_model")); + 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"), + qemu_opt_get(opts, "security_model")); len = strlen("virtio-9p-pci,fsdev=,mount_tag="); 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", - qemu_opt_get(opts, "mount_tag"), - qemu_opt_get(opts, "mount_tag")); + 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")); if (!qemu_opts_parse(qemu_find_opts("fsdev"), arg_fsdev, 1)) { fprintf(stderr, "parse error [fsdev]: %s\n", optarg); |