Skip to content

Commit 64f714b

Browse files
committed
Fix command injection vulnerability
1 parent 8b3b678 commit 64f714b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

check_smart.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,10 @@
159159

160160
foreach my $opt_dl (@dev){
161161
warn "Found $opt_dl\n" if $opt_debug;
162-
if (-b $opt_dl || -c $opt_dl || $opt_dl =~ m/^\/dev\/bus\/\d$/) {
162+
if (-l $opt_dl) {
163+
warn "$opt_dl is a symlink, skipping for security reasons\n\n" if $opt_debug;
164+
} elsif (-b $opt_dl || -c $opt_dl || $opt_dl =~ m/^\/dev\/bus\/\d$/) {
163165
$device .= $opt_dl."|";
164-
165166
} else {
166167
warn "$opt_dl is not a valid block/character special device!\n\n" if $opt_debug;
167168
}

0 commit comments

Comments
 (0)