]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Count components of the expanded path in _dl_init_path [BZ #22607]
authorFlorian Weimer <fweimer@redhat.com>
Thu, 14 Dec 2017 14:05:57 +0000 (15:05 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 14 Dec 2017 14:31:46 +0000 (15:31 +0100)
ChangeLog
NEWS
elf/dl-load.c

index 521ef46b995ac410a06bf12cb9de380809a76294..018edea1fbb6fe004c5454002daabc92ffeae53e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-12-14  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #22607]
+       CVE-2017-1000409
+       * elf/dl-load.c (_dl_init_paths): Compute number of components in
+       the expanded path string.
+
 2017-12-14  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #22606]
diff --git a/NEWS b/NEWS
index eef51b65a62395901a3b735696b0239e41a7ac20..c5607c855fb5bf7d41cbb6eb59b7d19707cfabe6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -130,6 +130,12 @@ Security related changes:
   it is mentioned here only because of the CVE assignment.)  Reported by
   Qualys.
 
+  CVE-2017-1000409: Buffer overflow in _dl_init_paths due to miscomputation
+  of the number of search path components.  (This is not a security
+  vulnerability per se because no trust boundary is crossed if the fix for
+  CVE-2017-1000366 has been applied, but it is mentioned here only because
+  of the CVE assignment.)  Reported by Qualys.
+
 The following bugs are resolved with this release:
 
   [The release manager will add the list generated by
index 5f1f908599b65d87f01116176a63220c2ab68bb0..bbd3be9e2060fede03dc0fab262d3fabcfe1b525 100644 (file)
@@ -773,8 +773,6 @@ _dl_init_paths (const char *llp)
 
   if (llp != NULL && *llp != '\0')
     {
-      size_t nllp;
-      const char *cp = llp;
       char *llp_tmp;
 
 #ifdef SHARED
@@ -797,13 +795,10 @@ _dl_init_paths (const char *llp)
 
       /* Decompose the LD_LIBRARY_PATH contents.  First determine how many
         elements it has.  */
-      nllp = 1;
-      while (*cp)
-       {
-         if (*cp == ':' || *cp == ';')
-           ++nllp;
-         ++cp;
-       }
+      size_t nllp = 1;
+      for (const char *cp = llp_tmp; *cp != '\0'; ++cp)
+       if (*cp == ':' || *cp == ';')
+         ++nllp;
 
       env_path_list.dirs = (struct r_search_path_elem **)
        malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));