]> Git Repo - qemu.git/commitdiff
hw/9pfs: Ensure an error is reported to user if 9pfs mount tag is too long
authorDaniel P. Berrange <[email protected]>
Wed, 12 Oct 2011 13:41:24 +0000 (19:11 +0530)
committerAneesh Kumar K.V <[email protected]>
Sat, 15 Oct 2011 10:00:26 +0000 (15:30 +0530)
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 <[email protected]>
Signed-off-by: Aneesh Kumar K.V <[email protected]>
hw/9pfs/virtio-9p-device.c

index 403eed089edf1a5c0c124a581c58a89ae568b517..4fcde50021f7d267450c2844a044620d445b8715 100644 (file)
@@ -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);
This page took 0.027464 seconds and 4 git commands to generate.