[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V4 02/13] hw/9pfs: Add validation to {un}marshal
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH V4 02/13] hw/9pfs: Add validation to {un}marshal code |
Date: |
Thu, 8 Dec 2011 18:10:12 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Dec 05, 2011 at 09:48:39PM +0530, M. Mohan Kumar wrote:
> @@ -187,59 +190,70 @@ size_t v9fs_unmarshal(struct iovec *out_sg, int
> out_num, size_t offset,
> }
> case 's': {
> V9fsString *str = va_arg(ap, V9fsString *);
> - offset += v9fs_unmarshal(out_sg, out_num, offset, bswap,
> - "w", &str->size);
> - /* FIXME: sanity check str->size */
> - str->data = g_malloc(str->size + 1);
> - offset += v9fs_unpack(str->data, out_sg, out_num, offset,
> - str->size);
> - str->data[str->size] = 0;
> + copied = v9fs_unmarshal(out_sg, out_num, offset, bswap,
> + "w", &str->size);
> + if (copied > 0) {
> + offset += copied;
> + str->data = g_malloc(str->size + 1);
str->size is signed int16_t, we need a check or the type should be
uint16_t.
Stefan
[Qemu-devel] [PATCH V4 05/13] hw/9pfs: Open and create files, M. Mohan Kumar, 2011/12/05
[Qemu-devel] [PATCH V4 06/13] hw/9pfs: Create other filesystem objects, M. Mohan Kumar, 2011/12/05
[Qemu-devel] [PATCH V4 07/13] hw/9pfs: Add stat/readlink/statfs for proxy FS, M. Mohan Kumar, 2011/12/05