diff options
author | Zhiqiang Liu <liuzhiqiang26@huawei.com> | 2020-11-05 16:33:22 +0800 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2020-11-06 19:26:03 +0000 |
commit | d614415a0c4ebf587e690ea209da1436e73fae19 (patch) | |
tree | 74028a63eda54961756be0392a094dd0d5975328 /lib | |
parent | 2fc070f148b91876bcca7323a0f2767eb4f8d6d1 (diff) | |
download | libfuse-d614415a0c4ebf587e690ea209da1436e73fae19.tar.gz |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/buffer.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) { |