]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Fix integer overflow in bit fields
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 27 Jul 2023 13:54:48 +0000 (13:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 27 Jul 2023 13:54:48 +0000 (13:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index 0544d756b031ce458a19b45294286c0a11eeb508..ac3ba0961f4388b5f2bb2e9df10fa27842d1ef71 100644 (file)
@@ -126,9 +126,9 @@ struct pakfire {
        magic_t magic;
 
        // States
-       int destroy_on_free:1;
-       int pool_ready:1;
-       int in_free:1;
+       unsigned int destroy_on_free:1;
+       unsigned int pool_ready:1;
+       unsigned int in_free:1;
 };
 
 /*
@@ -382,9 +382,11 @@ static void pakfire_free(struct pakfire* pakfire) {
        int r;
 
        // Avoid recursive free
-       if (pakfire->in_free++)
+       if (pakfire->in_free)
                return;
 
+       pakfire->in_free = 1;
+
        // Destroy the commandline repository
        repo = pakfire_get_repo(pakfire, PAKFIRE_REPO_COMMANDLINE);
        if (repo) {