aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p-device.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2011-10-12 19:11:24 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-10-15 15:30:26 +0530
commita2f507d9089f57525d58cd0852c6bea6720074e5 (patch)
tree32db2b25701a42d5f70dfe61b9b0ba68b7eff3df /hw/9pfs/virtio-9p-device.c
parentea60f31593cd7d16c6e557e8cf4caf1d1e1680b6 (diff)
downloadqemu-a2f507d9089f57525d58cd0852c6bea6720074e5.zip
qemu-a2f507d9089f57525d58cd0852c6bea6720074e5.tar.gz
qemu-a2f507d9089f57525d58cd0852c6bea6720074e5.tar.bz2
hw/9pfs: Ensure an error is reported to user if 9pfs mount tag is too long
If the 9pfs mount tag is longer than MAX_TAG_LEN bytes, rather than silently truncating the tag which will likely break the guest OS, report an immediate error and exit QEMU * hw/9pfs/virtio-9p-device.c: Report error & exit if mount tag is too long Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/virtio-9p-device.c')
-rw-r--r--hw/9pfs/virtio-9p-device.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 403eed0..4fcde50 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -119,7 +119,9 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
s->ctx.fs_root = g_strdup(fse->path);
len = strlen(conf->tag);
if (len > MAX_TAG_LEN) {
- len = MAX_TAG_LEN;
+ fprintf(stderr, "mount tag '%s' (%d bytes) is longer than "
+ "maximum (%d bytes)", conf->tag, len, MAX_TAG_LEN);
+ exit(1);
}
/* s->tag is non-NULL terminated string */
s->tag = g_malloc(len);