about summary refs log tree commit diff
path: root/grp
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2017-12-30 10:54:23 +0100
committerAurelien Jarno <aurelien@aurel32.net>2017-12-31 13:07:11 +0100
commitf24c345bf5486cc8d659f7a17463adcae402ec8e (patch)
treeccad5ed25f2bdcec2b8250af48772d3694f7b229 /grp
parent248475457e40d44b12f1f69c889765bba4571add (diff)
downloadglibc-f24c345bf5486cc8d659f7a17463adcae402ec8e.tar.gz
glibc-f24c345bf5486cc8d659f7a17463adcae402ec8e.tar.xz
glibc-f24c345bf5486cc8d659f7a17463adcae402ec8e.zip
elf: Check for empty tokens before dynamic string token expansion [BZ #22625]
The fillin_rpath function in elf/dl-load.c loops over each RPATH or
RUNPATH tokens and interprets empty tokens as the current directory
("./"). In practice the check for empty token is done *after* the
dynamic string token expansion. The expansion process can return an
empty string for the $ORIGIN token if __libc_enable_secure is set
or if the path of the binary can not be determined (/proc not mounted).

Fix that by moving the check for empty tokens before the dynamic string
token expansion. In addition, check for NULL pointer or empty strings
return by expand_dynamic_string_token.

The above changes highlighted a bug in decompose_rpath, an empty array
is represented by the first element being NULL at the fillin_rpath
level, but by using a -1 pointer in decompose_rpath and other functions.

Changelog:
	[BZ #22625]
	* elf/dl-load.c (fillin_rpath): Check for empty tokens before dynamic
	string token expansion. Check for NULL pointer or empty string possibly
	returned by expand_dynamic_string_token.
	(decompose_rpath): Check for empty path after dynamic string
	token expansion.
(cherry picked from commit 3e3c904daef69b8bf7d5cc07f793c9f07c3553ef)
Diffstat (limited to 'grp')
0 files changed, 0 insertions, 0 deletions