1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

elf: check for rpath emptiness before making a copy of it

* elf/dl-load.c (decompose_rpath): Check for rpath emptiness before
making a copy of it.
This commit is contained in:
Dmitry V. Levin
2017-12-27 22:12:51 +00:00
parent 66ac23dec2
commit dbba87d531
2 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2018-01-01 Dmitry V. Levin <ldv@altlinux.org>
* elf/dl-load.c (decompose_rpath): Check for rpath emptiness before
making a copy of it.
2018-01-01 Joseph Myers <joseph@codesourcery.com> 2018-01-01 Joseph Myers <joseph@codesourcery.com>
* manual/texinfo.tex: Update to version 2017-12-26.21 with * manual/texinfo.tex: Update to version 2017-12-26.21 with

View File

@ -499,7 +499,6 @@ decompose_rpath (struct r_search_path_struct *sps,
{ {
/* Make a copy we can work with. */ /* Make a copy we can work with. */
const char *where = l->l_name; const char *where = l->l_name;
char *copy;
char *cp; char *cp;
struct r_search_path_elem **result; struct r_search_path_elem **result;
size_t nelems; size_t nelems;
@ -538,22 +537,21 @@ decompose_rpath (struct r_search_path_struct *sps,
while (*inhp != '\0'); while (*inhp != '\0');
} }
/* Ignore empty rpaths. */
if (*rpath == '\0')
{
sps->dirs = (struct r_search_path_elem **) -1;
return false;
}
/* Make a writable copy. */ /* Make a writable copy. */
copy = __strdup (rpath); char *copy = __strdup (rpath);
if (copy == NULL) if (copy == NULL)
{ {
errstring = N_("cannot create RUNPATH/RPATH copy"); errstring = N_("cannot create RUNPATH/RPATH copy");
goto signal_error; goto signal_error;
} }
/* Ignore empty rpaths. */
if (*copy == 0)
{
free (copy);
sps->dirs = (struct r_search_path_elem **) -1;
return false;
}
/* Count the number of necessary elements in the result array. */ /* Count the number of necessary elements in the result array. */
nelems = 0; nelems = 0;
for (cp = copy; *cp != '\0'; ++cp) for (cp = copy; *cp != '\0'; ++cp)