From d614415a0c4ebf587e690ea209da1436e73fae19 Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu Date: Thu, 5 Nov 2020 16:33:22 +0800 Subject: [PATCH] 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: Zhiqiang Liu Signed-off-by: Haotian Liu --- lib/buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/buffer.c b/lib/buffer.c index 5ab9b87..ba07b26 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -266,6 +266,9 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len) { const struct fuse_buf *buf = fuse_bufvec_current(bufv); + if (!buf) + return 1; + bufv->off += len; assert(bufv->off <= buf->size); if (bufv->off == buf->size) { -- 2.30.2