[PATCH 1/2] erofs-utils: fix potential buffer overrun in __erofs_io_write()
Gao Xiang
hsiangkao at linux.alibaba.com
Mon Feb 17 13:49:28 AEDT 2025
.. due to short write, but it's almost impossible for most fses.
Coverity-id: 541575
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/io.c b/lib/io.c
index b6eb22a..5c3d263 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -31,7 +31,7 @@ ssize_t __erofs_io_write(int fd, const void *buf, size_t len)
ssize_t ret, written = 0;
do {
- ret = write(fd, buf, len);
+ ret = write(fd, buf, len - written);
if (ret <= 0) {
if (!ret)
break;
--
2.43.5
More information about the Linux-erofs
mailing list