sd-bus: make sure dispatch_rqueue() initializes return parameter on all types of...
authorLennart Poettering <lennart@poettering.net>
Thu, 17 Jan 2019 17:15:37 +0000 (18:15 +0100)
committerLukas Nykryn <lnykryn@redhat.com>
Thu, 6 Feb 2020 09:41:56 +0000 (10:41 +0100)
Let's make sure our own code follows coding style and initializes all
return values on all types of success (and leaves it uninitialized in
all types of failure).

(cherry picked from commit c0bc4ec5cc17ac61773d1e9362b0ffa8382c1ff1)
Related: CVE-2020-1712

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

index 64026f7ee1552a9bfa33d628609b42e406b36d6d..55b008cc9f34428f4590241f1fb292f05c98df24 100644 (file)
@@ -1814,8 +1814,10 @@ static int dispatch_rqueue(sd_bus *bus, bool hint_priority, int64_t priority, sd
                 r = bus_read_message(bus, hint_priority, priority);
                 if (r < 0)
                         return r;
-                if (r == 0)
+                if (r == 0) {
+                        *m = NULL;
                         return ret;
+                }
 
                 ret = 1;
         }