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 <liuzhiqiang26@huawei.com>
Signed-off-by: Haotian Liu <lihaotian9@huawei.com>
This commit is contained in:
Zhiqiang Liu
2020-11-05 16:33:22 +08:00
committed by Nikolaus Rath
parent fd3bc916f0
commit b95aba823b
+3
View File
@@ -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) {