This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.23-465-g31d0a4f


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  31d0a4fa646db8b8c97ce24e0ec0a7b73de4fca1 (commit)
      from  073f82140c7dbd7af387153c29ac7ac3e882c4ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=31d0a4fa646db8b8c97ce24e0ec0a7b73de4fca1

commit 31d0a4fa646db8b8c97ce24e0ec0a7b73de4fca1
Author: Florian Weimer <fweimer@redhat.com>
Date:   Sat Jun 11 12:12:56 2016 +0200

    nss_db: Fix initialization of iteration position [BZ #20237]
    
    When get*ent is called without a preceding set*ent, we need
    to set the initial iteration position in get*ent.
    
    Reproducer: Add â??services: db filesâ?? to /etc/nsswitch.conf, then run
    â??perl -e getserventâ??.  It will segfault before this change, and exit
    silently after it.

diff --git a/ChangeLog b/ChangeLog
index 2989d21..32bef33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2016-06-11  Florian Weimer  <fweimer@redhat.com>
 
+	[BZ #20237]
+	* nss/nss_db/db-XXX.c (set*ent): Reset entidx to NULL.
+	(get*ent): Set entidx to NULL during initialization.  If entidx is
+	NULL, start iteration from the beginning.
+
+2016-06-11  Florian Weimer  <fweimer@redhat.com>
+
 	* malloc/malloc.c (musable): Return correct size for dumped fake
 	mmapped chunk.
 
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index 125a5e9..2d13edd 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -77,7 +77,7 @@ CONCAT(_nss_db_set,ENTNAME) (int stayopen)
       keep_db |= stayopen;
 
       /* Reset the sequential index.  */
-      entidx  = (const char *) state.header + state.header->valstroffset;
+      entidx  = NULL;
     }
 
   __libc_lock_unlock (lock);
@@ -253,8 +253,14 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
 	  H_ERRNO_SET (NETDB_INTERNAL);
 	  goto out;
 	}
+      entidx = NULL;
     }
 
+  /* Start from the beginning if freshly initialized or reset
+     requested by set*ent.  */
+  if (entidx == NULL)
+    entidx = (const char *) state.header + state.header->valstroffset;
+
   status = NSS_STATUS_UNAVAIL;
   if (state.header != MAP_FAILED)
     {

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    7 +++++++
 nss/nss_db/db-XXX.c |    8 +++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]