Fix config not being applied

Resolves: RHEL-78405
This commit is contained in:
Bastien Nocera 2025-02-10 16:17:04 +01:00
parent 5984e0b8f5
commit 7d5d270a51
2 changed files with 16 additions and 11 deletions

View File

@ -1,4 +1,4 @@
From 3cf5bb59c3f82e1fcc8703e6bab956284f2c4566 Mon Sep 17 00:00:00 2001 From 60b4624089e460a4908c1887de0e777c0453a503 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net> From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 10 May 2024 13:47:29 +0200 Date: Fri, 10 May 2024 13:47:29 +0200
Subject: [PATCH] main: Simplify parse_config_string() Subject: [PATCH] main: Simplify parse_config_string()
@ -25,22 +25,23 @@ bluez-5.75/src/main.c:440:2: leaked_storage: Variable "tmp" going out of scope l
441| } 441| }
442| 442|
--- ---
src/main.c | 22 +++++++++++++--------- src/main.c | 23 ++++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-) 1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/main.c b/src/main.c diff --git a/src/main.c b/src/main.c
index 62453bffaf57..178611e11ddd 100644 index d13ada2afc5b..bde63462ecda 100644
--- a/src/main.c --- a/src/main.c
+++ b/src/main.c +++ b/src/main.c
@@ -420,9 +420,13 @@ static bool parse_config_string(GKeyFile *config, const char *group, @@ -430,9 +430,14 @@ static bool parse_config_string(GKeyFile *config, const char *group,
const char *key, char **val) const char *key, char **val)
{ {
GError *err = NULL; GError *err = NULL;
- char *tmp; - char *tmp;
- tmp = g_key_file_get_string(config, group, key, &err); - tmp = g_key_file_get_string(config, group, key, &err);
+ if (val != NULL) { + if (val == NULL) {
+ warn("%s passed a NULL value", __func__); + warn("%s passed a NULL value to parse [%s] %s",
+ __func__, group, key);
+ return false; + return false;
+ } + }
+ +
@ -48,7 +49,7 @@ index 62453bffaf57..178611e11ddd 100644
if (err) { if (err) {
if (err->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND) if (err->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND)
DBG("%s", err->message); DBG("%s", err->message);
@@ -430,12 +434,7 @@ static bool parse_config_string(GKeyFile *config, const char *group, @@ -440,12 +445,7 @@ static bool parse_config_string(GKeyFile *config, const char *group,
return false; return false;
} }
@ -62,7 +63,7 @@ index 62453bffaf57..178611e11ddd 100644
return true; return true;
} }
@@ -1004,7 +1003,12 @@ static void parse_secure_conns(GKeyFile *config) @@ -1031,7 +1031,12 @@ static void parse_secure_conns(GKeyFile *config)
static void parse_general(GKeyFile *config) static void parse_general(GKeyFile *config)
{ {
@ -77,5 +78,5 @@ index 62453bffaf57..178611e11ddd 100644
parse_config_u32(config, "General", "DiscoverableTimeout", parse_config_u32(config, "General", "DiscoverableTimeout",
&btd_opts.discovto, &btd_opts.discovto,
-- --
2.45.2 2.48.1

View File

@ -6,7 +6,7 @@
Name: bluez Name: bluez
Version: 5.77 Version: 5.77
Release: 5%{?dist} Release: 6%{?dist}
Summary: Bluetooth utilities Summary: Bluetooth utilities
License: GPL-2.0-or-later License: GPL-2.0-or-later
URL: http://www.bluez.org/ URL: http://www.bluez.org/
@ -339,6 +339,10 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
%{_userunitdir}/obex.service %{_userunitdir}/obex.service
%changelog %changelog
* Mon Feb 10 2025 Bastien Nocera <bnocera@redhat.com> - 5.77-6
- Fix config not being applied
- Resolves: RHEL-78405
* Thu Jan 30 2025 Bastien Nocera <bnocera@redhat.com> - 5.77-5 * Thu Jan 30 2025 Bastien Nocera <bnocera@redhat.com> - 5.77-5
- Fix wordexp() related crasher - Fix wordexp() related crasher
- Resolves: RHEL-56021 - Resolves: RHEL-56021