]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: use usec_add() for auth timeout calculation
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 28 Mar 2026 21:37:47 +0000 (21:37 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 30 Mar 2026 08:37:32 +0000 (09:37 +0100)
Use the overflow-safe usec_add() instead of raw addition for
computing the authentication timeout.

CID#1548036

Follow-up for e3017af97310da024ffb378ed155bc1676922ce7

src/libsystemd/sd-bus/bus-socket.c

index 3c6a2b2747fb9fedbed3bc10c596963bfad3883d..fdbf557f137cf7809ef19ea4415faba39ad9c593 100644 (file)
@@ -788,7 +788,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;