public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nss/29862] New: Core dump in the nss module
@ 2022-12-07  9:48 kircherlike at outlook dot com
  2022-12-07  9:58 ` [Bug nss/29862] " schwab@linux-m68k.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kircherlike at outlook dot com @ 2022-12-07  9:48 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29862

            Bug ID: 29862
           Summary: Core dump in the nss module
           Product: glibc
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: nss
          Assignee: unassigned at sourceware dot org
          Reporter: kircherlike at outlook dot com
  Target Milestone: ---

Hi ,maintainer of the community, I found that null pointers were not protected
in the following functions when I performed fault injection locally, causing
Program terminated with signal SIGSEGV, Segmentation fault.

【log】:
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f273d642e5d in __GI___nss_lookup_function (fct_name=0x7f273d6c54a1
"getpwuid_r", ni=<optimized out>) at nsswitch.c:136
136       if (ni->module == NULL)

【Here's my modified patch】:
diff --git a/nss/nss_module.c b/nss/nss_module.c
index b28cb94a..bb2807e9 100644
--- a/nss/nss_module.c
+++ b/nss/nss_module.c
@@ -352,7 +352,7 @@ nss_load_all_libraries (enum nss_database service)
 {
   nss_action_list ni = NULL;

-  if (__nss_database_get (service, &ni))
+  if (__nss_database_get (service, &ni) && ni != NULL)
     while (ni->module != NULL)
       {
         __nss_module_load (ni->module);
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 6b7d4c78..c9d7e372 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -133,7 +133,7 @@ libc_hidden_def (__nss_next2)
 void *
 __nss_lookup_function (nss_action_list ni, const char *fct_name)
 {
-  if (ni->module == NULL)
+  if (ni == NULL || ni->module == NULL)
     return NULL;
   return __nss_module_get_function (ni->module, fct_name);
 }
-- 

Looking forward to your reply

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-14  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07  9:48 [Bug nss/29862] New: Core dump in the nss module kircherlike at outlook dot com
2022-12-07  9:58 ` [Bug nss/29862] " schwab@linux-m68k.org
2022-12-08  1:52 ` kircherlike at outlook dot com
2022-12-14  7:47 ` sam at gentoo dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).