Blame SOURCES/b82b670bfec6600d0144bcb9ca635fb07c80118f.patch

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