sd-bus: make rqueue/wqueue sizes of type size_t
authorLennart Poettering <lennart@poettering.net>
Thu, 17 Jan 2019 17:13:03 +0000 (18:13 +0100)
committerLukas Nykryn <lnykryn@redhat.com>
Thu, 6 Feb 2020 09:41:56 +0000 (10:41 +0100)
Let's do this like we usually do and size arrays with size_t.

We already do this for the "allocated" counter correctly, and externally
we expose the queue sizes as uint64_t anyway, hence there's really no
point in usigned "unsigned" internally.

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

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

index 5d773b14c4dfda395eaf55b5f8f93f15d2fe0929..06bd7862cbfca967d2ad9a06781313de8c4c767c 100644 (file)
@@ -221,11 +221,11 @@ struct sd_bus {
         size_t rbuffer_size;
 
         sd_bus_message **rqueue;
-        unsigned rqueue_size;
+        size_t rqueue_size;
         size_t rqueue_allocated;
 
         sd_bus_message **wqueue;
-        unsigned wqueue_size;
+        size_t wqueue_size;
         size_t windex;
         size_t wqueue_allocated;
 
index 1c9e967ae056bcd69a3e64c485d27900589c8ae4..64026f7ee1552a9bfa33d628609b42e406b36d6d 100644 (file)
@@ -2080,7 +2080,7 @@ _public_ int sd_bus_call(
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = sd_bus_message_ref(_m);
         usec_t timeout;
         uint64_t cookie;
-        unsigned i;
+        size_t i;
         int r;
 
         bus_assert_return(m, -EINVAL, error);