glibc/fix_nss_database_check_reload_and_get_memleak.patch

39 lines
1.3 KiB
Diff
Raw Normal View History

2023-08-07 19:56:19 +08:00
From 66c23fa97a1bf8819051f1c358ae5eb38eeefae2 Mon Sep 17 00:00:00 2001
From: huangyu <huangyu106@huawei.com>
Date: Tue, 6 Sep 2022 11:55:40 +0800
Subject: [PATCH] huawei-fix_nss_database_check_reload_and_get_memleak.patch
The return nss_database_check_reload_adn_get (local, actions, db) does not check
whether the local value is empty before invoking the local interface.
Signed-off-by: huangyu <huangyu106@huawei.com>
---
nss/nss_database.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/nss/nss_database.c b/nss/nss_database.c
index 54561f03..a503890a 100644
--- a/nss/nss_database.c
+++ b/nss/nss_database.c
@@ -254,6 +254,8 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
__nss_database_get (db, &result);
local = nss_database_state_get ();
+ if (local == NULL)
+ return -1;
result = __nss_action_parse (service_line);
if (result == NULL)
@@ -399,6 +401,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
/* Acquire MO is needed because the thread that sets reload_disabled
may have loaded the configuration first, so synchronize with the
Release MO store there. */
+ if (local == NULL)
+ return false;
+
if (atomic_load_acquire (&local->data.reload_disabled))
{
*result = local->data.services[database_index];
--
2.33.0