Ensure an error is reported to user if 9pfs mount tag is too long
PATCH 1/1 Ensure an error is reported to user if 9pfs mount tag is too long
From: "Daniel P. Berrange" <[email protected]>
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
--- hw/9pfs/virtio-9p-device.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
hw/9pfs/virtio-9p-device.c +3 -1
@@ -117,7 +117,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);
Signature · 1 line
1.7.6.2
Aneesh Kumar K.V
AppliedQuoted 10 lines · Daniel P. Berrange
From: "Daniel P. Berrange" <[email protected]>
If the 9pfs mount tag is longer than
MAX_TAG_LENbytes, 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 longSigned-off-by Daniel P. Berrange <[email protected]>
Applied to the VirtFS (git://repo.or.cz/qemu/v9fs.git). I have to apply by hand, because it didn't apply cleanly. I also fixed checkpatch.pl errors.
Quoted 23 lines
--- hw/9pfs/virtio-9p-device.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)hw/9pfs/virtio-9p-device.c +3
-1@@ -117,7 +117,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);Signature · 1 line
1.7.6.2
-aneesh