sd-bus: use usec_add() for auth timeout calculation

Use the overflow-safe usec_add() instead of raw addition for
computing the authentication timeout.

CID#1548036

Follow-up for e3017af973

(cherry picked from commit aa2cc18c76)
This commit is contained in:
Luca Boccassi
2026-03-28 21:37:47 +00:00
parent 4bc0c98834
commit 425bca3c26

View File

@@ -786,7 +786,7 @@ int bus_socket_start_auth(sd_bus *b) {
bus_get_peercred(b);
bus_set_state(b, BUS_AUTHENTICATING);
b->auth_timeout = now(CLOCK_MONOTONIC) + BUS_AUTH_TIMEOUT;
b->auth_timeout = usec_add(now(CLOCK_MONOTONIC), BUS_AUTH_TIMEOUT);
if (sd_is_socket(b->input_fd, AF_UNIX, 0, 0) <= 0)
b->accept_fd = false;