File nscd-gethst-race.patch of Package glibc.39825

Index: glibc-2.38/nscd/nscd_gethst_r.c
===================================================================
--- glibc-2.38.orig/nscd/nscd_gethst_r.c
+++ glibc-2.38/nscd/nscd_gethst_r.c
@@ -397,6 +397,12 @@ nscd_gethst_r (const char *key, size_t k
 	  memcpy (resultbuf->h_aliases[0],
 		  (const char *) addr_list + addr_list_len, total_len);
 
+	  if (mapped->head->gc_cycle != gc_cycle)
+	    {
+	      retval = -2;
+	      goto out_close;
+	    }
+
 	  /* Try to detect corrupt databases.  */
 	  if (resultbuf->h_name[hst_resp.h_name_len - 1] != '\0'
 	      || ({for (cnt = 0; cnt < hst_resp.h_aliases_cnt; ++cnt)
openSUSE Build Service is sponsored by