mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
mtrace: make shell commands robust against meta characters
Use the list form of the open function to avoid interpreting meta characters in the arguments.
This commit is contained in:
parent
aecde502e9
commit
2a6c922f09
@ -87,7 +87,7 @@ if ($#ARGV == 0) {
|
||||
}
|
||||
# Set the environment variable LD_TRACE_LOADED_OBJECTS to 2 so the
|
||||
# executable is also printed.
|
||||
if (open (locs, "env LD_TRACE_LOADED_OBJECTS=2 $prog |")) {
|
||||
if (open (locs, "-|", "env", "LD_TRACE_LOADED_OBJECTS=2", $prog)) {
|
||||
while (<locs>) {
|
||||
chop;
|
||||
if (/^.*=> (.*) .(0x[0123456789abcdef]*).$/) {
|
||||
@ -104,7 +104,7 @@ if ($#ARGV == 0) {
|
||||
sub addr2line {
|
||||
my $addr = pop(@_);
|
||||
my $prog = pop(@_);
|
||||
if (open (ADDR, "addr2line -e $prog $addr|")) {
|
||||
if (open (ADDR, "-|", "addr2line", "-e", $prog, $addr)) {
|
||||
my $line = <ADDR>;
|
||||
chomp $line;
|
||||
close (ADDR);
|
||||
|
Loading…
Reference in New Issue
Block a user