From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZmk-00028U-Cp for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:42:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDZmi-0001MS-8z for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:42:10 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:35043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDZmh-0001Lj-LM for qemu-devel@nongnu.org; Tue, 11 Oct 2011 06:42:08 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp01.au.ibm.com (8.14.4/8.13.1) with ESMTP id p9BAeJZM028666 for ; Tue, 11 Oct 2011 21:40:19 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9BAfvGx2568316 for ; Tue, 11 Oct 2011 21:41:57 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9BAfvbh022787 for ; Tue, 11 Oct 2011 21:41:57 +1100 From: "Aneesh Kumar K.V" Date: Tue, 11 Oct 2011 16:11:38 +0530 Message-Id: <1318329705-3179-7-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1318329705-3179-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1318329705-3179-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH -V2 06/13] hw/9pfs: Ensure an error is reported to user if 9pfs mount tag is too long List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, "Aneesh Kumar K.V" From: "Daniel P. Berrange" 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 Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/virtio-9p-device.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index b23e8a4..0930d22 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); -- 1.7.5.4