fuse_buf_size fix for SIZE_MAX

This commit is contained in:
leipeng 2024-10-11 15:54:14 +08:00 committed by Bernd Schubert
parent 535808c4d9
commit fdafc1d1c6

View File

@ -25,10 +25,10 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv)
size_t size = 0;
for (i = 0; i < bufv->count; i++) {
if (bufv->buf[i].size == SIZE_MAX)
size = SIZE_MAX;
else
size += bufv->buf[i].size;
if (bufv->buf[i].size >= SIZE_MAX - size)
return SIZE_MAX;
size += bufv->buf[i].size;
}
return size;