mirror of
https://github.com/systemd/systemd.git
synced 2026-08-07 16:41:02 +00:00
uid-range: add assert to silence coverity
Coverity flags range->n_entries - j - 1 and j-- as potential
underflows. Add an assert that j > 0 before decrementing, since
j starts at i + 1 >= 1 and is never decremented below its
initial value.
CID#1548015
Follow-up for 8dcc66cefc
This commit is contained in:
@@ -76,6 +76,9 @@ static void uid_range_coalesce(UIDRange *range) {
|
||||
memmove(y, y + 1, sizeof(UIDRangeEntry) * (range->n_entries - j - 1));
|
||||
|
||||
range->n_entries--;
|
||||
|
||||
/* Silence static analyzers, j cannot be 0 here since it starts at i + 1, i.e. >= 1 */
|
||||
assert(j > 0);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user