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