Blame SOURCES/b82b670bfec6600d0144bcb9ca635fb07c80118f.patch

3bac29
From b82b670bfec6600d0144bcb9ca635fb07c80118f Mon Sep 17 00:00:00 2001
3bac29
From: David Rheinsberg <david.rheinsberg@gmail.com>
3bac29
Date: Thu, 18 Mar 2021 12:13:16 +0100
3bac29
Subject: [PATCH] launch/policy: fix at_console range assertion again
3bac29
3bac29
The previous fix did not actually consider that a full range can span up
3bac29
until (uint32_t)-1. Fix this properly now, and just check manually for
3bac29
an empty range before checking that the highest entry in the range can
3bac29
be represented.
3bac29
3bac29
Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
3bac29
---
3bac29
 src/launch/policy.c | 4 +---
3bac29
 1 file changed, 1 insertion(+), 3 deletions(-)
3bac29
3bac29
diff --git a/src/launch/policy.c b/src/launch/policy.c
3bac29
index 75eb0d3..6999ceb 100644
3bac29
--- a/src/launch/policy.c
3bac29
+++ b/src/launch/policy.c
3bac29
@@ -935,9 +935,7 @@ static int policy_export_console(Policy *policy, sd_bus_message *m, PolicyEntrie
3bac29
         int r;
3bac29
 
3bac29
         /* check for overflow */
3bac29
-        c_assert(uid_start + n_uid >= uid_start);
3bac29
-        /* check for encoding into dbus `u` type */
3bac29
-        c_assert(uid_start + n_uid <= (uint32_t)-1);
3bac29
+        c_assert(n_uid == 0 || uid_start + n_uid - 1 >= uid_start);
3bac29
 
3bac29
         if (n_uid == 0)
3bac29
                 return 0;