From: Haotian Li Date: Wed, 11 Nov 2020 01:05:56 +0000 (+0800) Subject: tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7fa87944f82d75d21b7166570ac87d7874c151d5;p=qemu.git tools/virtiofsd/buffer.c: check whether buf is NULL in fuse_bufvec_advance func In fuse_bufvec_advance func, calling fuse_bufvec_current func may return NULL, so we should check whether buf is NULL before using it. Signed-off-by: Haotian Li Signed-off-by: Zhiqiang Liu Message-Id: <29fc87c2-b87c-4c34-40d4-75381f228849@huawei.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c index 27c1377f22..bdc608c221 100644 --- a/tools/virtiofsd/buffer.c +++ b/tools/virtiofsd/buffer.c @@ -246,6 +246,10 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len) { const struct fuse_buf *buf = fuse_bufvec_current(bufv); + if (!buf) { + return 0; + } + bufv->off += len; assert(bufv->off <= buf->size); if (bufv->off == buf->size) {