Codebase list debian-goodies / fc748ff
Use IPC::System::Simple capturex instead of capture capturex avoids using the shell at all, which is the proper way to prevent shell meta-character injection. Also remove a comment that would use the shell if it were uncommented and changed from qq to qx. See-also: http://bonedaddy.net/pabs3/log/2014/02/17/pid-preservation-society/ Paul Wise 6 years ago
1 changed file(s) with 5 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2222 use warnings FATAL => 'all';
2323 use autodie qw(:all);
2424 use v5.14;
25 use IPC::System::Simple qw(capture);
25 use IPC::System::Simple qw(capturex);
2626
2727 $ENV{LC_ALL} = 'C';
2828
109109 sub get_build_ids_from_core
110110 {
111111 my ($filename) = @_;
112 my $output = capture("eu-unstrip -n --core=\Q$filename\E");
112 my $output = capturex(qw(eu-unstrip -n --core), $filename);
113113
114114 return parse_eu_unstrip($output);
115115 }
117117 sub get_build_ids_from_pid
118118 {
119119 my ($pid) = @_;
120 my $output = capture("eu-unstrip -n -p \Q$pid\E");
120 my $output = capturex(qw(eu-unstrip -n -p), $pid);
121121 chomp $output;
122122
123123 return parse_eu_unstrip($output);
129129
130130 my $output;
131131 eval {
132 $output = capture("grep-aptavail -s Package -F Build-IDs \Q$id\E");
132 $output = capturex(qw(grep-aptavail -s Package -F Build-IDs), $id);
133133 };
134134 if ($@) {
135135 return;
150150 sub is_core_file
151151 {
152152 my ($filename) = (@_);
153 # warn qq{eu-readelf -n \Q$filename\E};
154 my $output = capture("eu-readelf -h \Q$filename\E");
153 my $output = capturex(qw(eu-readelf -h), $filename);
155154 if ($output =~ /^\s*Type:\s*CORE/m) {
156155 return 1;
157156 }