From 2bd6930efeace1ef0bae4683ef38e9ad6f74dcd0 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 28 Mar 2026 20:10:14 +0000 Subject: [PATCH] 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 3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3 --- src/import/importd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/import/importd.c b/src/import/importd.c index d3363d446c..fed2af4170 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -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);