importd: add assert for log_message_size accumulation bounds

Coverity flags log_message_size += l as a potential overflow, but l
is bounded by the read() count parameter which is
sizeof(log_message) - log_message_size. Add an assert to make this
invariant explicit.

CID#1548062

Follow-up for 3d7415f43f
This commit is contained in:
Luca Boccassi
2026-03-28 20:10:14 +00:00
parent c34169e9d3
commit 2bd6930efe
+2
View File
@@ -418,6 +418,8 @@ static int transfer_on_log(sd_event_source *s, int fd, uint32_t revents, void *u
return 0;
}
/* Silence static analyzers, l is bounded by read() count: sizeof - log_message_size */
assert((size_t) l <= sizeof(t->log_message) - t->log_message_size);
t->log_message_size += l;
transfer_send_logs(t, false);