Skip to content

Commit 5e888a1

Browse files
Work around Coverity false positive
CID 456638 Overflowed integer argument (INTEGER_OVERFLOW) `buffer_size - total_bytes_read - 1UL`, which might have underflowed, is passed to `read()`.
1 parent 7d6542d commit 5e888a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int ipv4_get_route(struct rtentry *route)
178178

179179
while ((bytes_read = read(fd, buffer + total_bytes_read,
180180
buffer_size - total_bytes_read - 1)) > 0) {
181-
assert(SIZE_MAX - total_bytes_read - 1 >= bytes_read);
181+
assert(buffer_size - total_bytes_read > bytes_read);
182182
total_bytes_read += bytes_read;
183183

184184
if ((buffer_size - total_bytes_read) < 1) {

0 commit comments

Comments
 (0)