00db10
commit 3ff3dfa5af313a6ea33f3393916f30eece4f0171
00db10
Author: Florian Weimer <fweimer@redhat.com>
00db10
Date:   Thu Dec 14 15:05:57 2017 +0100
00db10
00db10
    elf: Count components of the expanded path in _dl_init_path [BZ #22607]
00db10
00db10
Index: glibc-2.17-c758a686/elf/dl-load.c
00db10
===================================================================
00db10
--- glibc-2.17-c758a686.orig/elf/dl-load.c
00db10
+++ glibc-2.17-c758a686/elf/dl-load.c
00db10
@@ -829,8 +829,6 @@ _dl_init_paths (const char *llp)
00db10
 
00db10
   if (llp != NULL && *llp != '\0')
00db10
     {
00db10
-      size_t nllp;
00db10
-      const char *cp = llp;
00db10
       char *llp_tmp;
00db10
 
00db10
 #ifdef SHARED
00db10
@@ -853,13 +851,10 @@ _dl_init_paths (const char *llp)
00db10
 
00db10
       /* Decompose the LD_LIBRARY_PATH contents.  First determine how many
00db10
 	 elements it has.  */
00db10
-      nllp = 1;
00db10
-      while (*cp)
00db10
-	{
00db10
-	  if (*cp == ':' || *cp == ';')
00db10
-	    ++nllp;
00db10
-	  ++cp;
00db10
-	}
00db10
+      size_t nllp = 1;
00db10
+      for (const char *cp = llp_tmp; *cp != '\0'; ++cp)
00db10
+	if (*cp == ':' || *cp == ';')
00db10
+	  ++nllp;
00db10
 
00db10
       env_path_list.dirs = (struct r_search_path_elem **)
00db10
 	malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));