]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: Fix crash while parsing config with libeconf
authorStanislav Brabec <sbrabec@suse.cz>
Fri, 16 May 2025 01:10:14 +0000 (03:10 +0200)
committerStanislav Brabec <sbrabec@suse.cz>
Fri, 16 May 2025 20:19:45 +0000 (22:19 +0200)
As the whole econf_file structure is freed by econf_free(file) at the end
of blkid_read_config(), econf_file structure cannot be defined as static
and initialized only once. The econf_free() is not robust enough and keeps
a pointer to the garbage after the first call of blkid_read_config(). And
if /etc/blkid.conf does not exist, it is called second time.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Stefan Schubert <schubi@suse.de>
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1242705
libblkid/src/config.c

index 934d28d65afcfc6286efdc09605fe8d6237cb990..39024b42e85a81a5cabd244be5ce5c16fa147ca0 100644 (file)
@@ -154,7 +154,7 @@ struct blkid_config *blkid_read_config(const char *filename)
 
 #else /* !HAVE_LIBECONF */
 
-       static econf_file *file = NULL;
+       econf_file *file = NULL;
        char *line = NULL;
        bool uevent = false;
        econf_err error;