aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoromni <omni+alpine@hack.org>2024-04-13 14:17:07 +0000
committeromni <omni+alpine@hack.org>2024-04-13 14:17:07 +0000
commit1120d76877f5adf4f750f0767d818ec227491460 (patch)
tree8cc6dbe71aaae08225b4c2eb988d8d94e2490edc
parent1edfe2bf562ba0733f2abe36bd5241442d34c5a6 (diff)
main/util-linux: fix segfault when blkid.conf doesn't exist
fixes #15981
-rw-r--r--main/util-linux/0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch78
-rw-r--r--main/util-linux/APKBUILD4
2 files changed, 81 insertions, 1 deletions
diff --git a/main/util-linux/0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch b/main/util-linux/0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch
new file mode 100644
index 00000000000..b1d83c05a6f
--- /dev/null
+++ b/main/util-linux/0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch
@@ -0,0 +1,78 @@
+From 7e357241b413a01c37b0b4d064bc0a47e3259361 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Mon, 1 Apr 2024 12:14:50 +0200
+Subject: [PATCH] libblkid: Fix segfault when blkid.conf doesn't exist
+
+* Move 'line' and 'uevent' to the beginning of the LIBECONF code.
+* Remove unwanted space between function name and arguments.
+* Check for 'line' pointer before dereferencing.
+
+References: https://github.com/util-linux/util-linux/pull/2883
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ libblkid/src/config.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/libblkid/src/config.c b/libblkid/src/config.c
+index 7b8b04f92..66c1864f0 100644
+--- a/libblkid/src/config.c
++++ b/libblkid/src/config.c
+@@ -153,6 +153,8 @@ struct blkid_config *blkid_read_config(const char *filename)
+ #else /* !HAVE_LIBECONF */
+
+ static econf_file *file = NULL;
++ char *line = NULL;
++ bool uevent = false;
+ econf_err error;
+
+ if (filename) {
+@@ -187,7 +189,6 @@ struct blkid_config *blkid_read_config(const char *filename)
+ }
+ }
+
+- bool uevent = false;
+ if ((error = econf_getBoolValue(file, NULL, "SEND_UEVENT", &uevent))) {
+ if (error != ECONF_NOKEY) {
+ DBG(CONFIG, ul_debug("couldn't fetch SEND_UEVENT corrently: %s", econf_errString(error)));
+@@ -209,7 +210,6 @@ struct blkid_config *blkid_read_config(const char *filename)
+ }
+ }
+
+- char *line = NULL;
+ if ((error = econf_getStringValue(file, NULL, "EVALUATE", &line))) {
+ conf->nevals = 0;
+ if (error != ECONF_NOKEY) {
+@@ -219,7 +219,7 @@ struct blkid_config *blkid_read_config(const char *filename)
+ DBG(CONFIG, ul_debug("key CACHE_FILE not found, using built-in default "));
+ }
+ } else {
+- if (*line && parse_evaluate(conf, line) == -1)
++ if (line && *line && parse_evaluate(conf, line) == -1)
+ goto err;
+ }
+
+@@ -238,8 +238,8 @@ dflt:
+ if (f)
+ fclose(f);
+ #else
+- econf_free (file);
+- free (line);
++ econf_free(file);
++ free(line);
+ #endif
+ return conf;
+ err:
+@@ -248,8 +248,8 @@ err:
+ #ifndef HAVE_LIBECONF
+ fclose(f);
+ #else
+- econf_free (file);
+- free (line);
++ econf_free(file);
++ free(line);
+ #endif
+ return NULL;
+ }
+--
+2.44.0
+
diff --git a/main/util-linux/APKBUILD b/main/util-linux/APKBUILD
index 421126fd709..aa29dc31dad 100644
--- a/main/util-linux/APKBUILD
+++ b/main/util-linux/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=util-linux
pkgver=2.40
-pkgrel=0
+pkgrel=1
pkgdesc="Random collection of Linux utilities"
url="https://git.kernel.org/cgit/utils/util-linux/util-linux.git"
arch="all"
@@ -82,6 +82,7 @@ case $pkgver in
esac
source="https://www.kernel.org/pub/linux/utils/util-linux/v$_v/util-linux-$pkgver.tar.xz
utmps.patch
+ 0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch
ttydefaults.h
rfkill.confd
rfkill.initd
@@ -349,6 +350,7 @@ _py3() {
sha512sums="
f06e61d4ee0e196223f7341ec75a16a6671f82d6e353823490ecff17e947bb169a6b65177e3ab0da6e733e079b24d6a77905a0e8bbfed82ca9aa22a3facb6180 util-linux-2.40.tar.xz
c1c9cd816d20582438cda75a9c0ea4e687eee124e657172729aff410f52558be19cc5d649dae07c03f7618411e5aa6c23bcebc3fdf25529517a61b6b343966ef utmps.patch
+d0fbba3fb3a7ca56e6c2fbe63557bac01c25389e21c51ff5c111463a96a7b8e2eacbc5d02db811dbc3807031543ec1fc759a9669ed26e059dafdce8ae16a1558 0001-libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch
876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h
401d2ccbdbfb0ebd573ac616c1077e2c2b79ff03e9221007759d8ac25eb522c401f705abbf7daac183d5e8017982b8ec5dd0a5ebad39507c5bb0a9f31f04ee97 rfkill.confd
b0e11226c611fd52d54f599a40d23c4f748d5bd6971732dba2d25581aedaf5d2c62bcb49515d175569ff9aa1cf49a3dff25d1a5d4dcd89428c7020fc7ea3a581 rfkill.initd