]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
io-util: add one more assertion for Coverity
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 19 Mar 2025 02:21:46 +0000 (11:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 19 Mar 2025 02:41:25 +0000 (11:41 +0900)
Fixes CID#1548067.

src/basic/io-util.c

index f12f6b192c968d10e8a2806e10522f8d241fd986..7d7f34f2035300a376226a8824486d98347d0e26 100644 (file)
@@ -86,6 +86,7 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
                         return n;
 
                 assert((size_t) k <= nbytes);
+                assert(k <= SSIZE_MAX - n);
 
                 p += k;
                 nbytes -= k;