diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-12-14 15:05:57 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-12-14 15:31:46 +0100 |
commit | 3ff3dfa5af313a6ea33f3393916f30eece4f0171 (patch) | |
tree | 41be59a9eb6037aba0ee37116d2b35c0a324392f /elf | |
parent | 8a0b17e48b83e933960dfeb8fa08b259f03f310e (diff) | |
download | glibc-3ff3dfa5af313a6ea33f3393916f30eece4f0171.tar.gz glibc-3ff3dfa5af313a6ea33f3393916f30eece4f0171.tar.xz glibc-3ff3dfa5af313a6ea33f3393916f30eece4f0171.zip |
elf: Count components of the expanded path in _dl_init_path [BZ #22607]
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-load.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c index 5f1f908599..bbd3be9e20 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -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 *)); |