Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI and RuleSet::assignID regressions #628

Merged
merged 8 commits into from
Jun 6, 2024
Merged
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ name: C/C++ CI
on:
push:
pull_request:
schedule:
- cron: '0 4 * * 5' # Every Friday at 4am

# Drop permissions to minimum for security
permissions:
contents: read

jobs:
build:

runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
config:
- {
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ name: Build on non-Ubuntu Linux using Docker
on:
push:
pull_request:
schedule:
- cron: '0 4 * * 5' # Every Friday at 4am

# Drop permissions to minimum for security
permissions:
contents: read

jobs:
build_docker:
strategy:
fail-fast: false
matrix:
linux_distro:
- Alpine Linux 3.15 # with musl
- Alpine Linux 3.20 # with musl
- CentOS 8.2 # with GCC 8.5.0
- Debian Buster with GCC 9.2 # stock buster has GCC 8.3
- Ubuntu 22.04 # because super popular
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/polkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ name: Check for Polkit policy parse errors
on:
push:
pull_request:
schedule:
- cron: '0 4 * * 5' # Every Friday at 4am

# Drop permissions to minimum for security
permissions:
contents: read

jobs:
polkit_policies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.

FROM alpine:3.15
FROM alpine:3.20
RUN echo '@edge-testing https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \
&& \
apk add --update \
asciidoc \
autoconf \
automake \
bash \
dbus-glib-dev \
file \
g++ \
Expand Down
11 changes: 6 additions & 5 deletions src/Library/public/usbguard/RuleSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,13 @@ namespace usbguard
uint32_t RuleSet::assignID()
{
const auto next_id = _id_next + 1;
if (next_id >= Rule::LastID) [[unlikely]]
{
throw std::out_of_range("Rule ID too high");
}

if (next_id >= Rule::LastID) {
throw std::out_of_range("Rule ID too high");
}

_id_next = next_id;
return next_id;
return next_id - 1;
Cropi marked this conversation as resolved.
Show resolved Hide resolved
}

void RuleSet::setWritable()
Expand Down