Просмотр исходного кода

Dpkg::IPC: avoid surprising execution via the shell

* scripts/Dpkg/IPC.pm (fork_and_exec): If @prog only
contains one entry exec() might execute it via the
shell if it deems it necessary. This is not intended,
so avoid this by giving $prog[0] explicetly as the
program to execute.
Frank Lichtenheld лет назад: 18
Родитель
Сommit
07c81f94aa
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      scripts/Dpkg/IPC.pm

+ 1 - 1
scripts/Dpkg/IPC.pm

@@ -75,7 +75,7 @@ sub fork_and_exec {
 	# Close some inherited filehandles
         close($_) foreach (@{$opts{"close_in_child"}});
 	# Execute the program
-        exec(@prog) or syserr(_g("exec %s"), "@prog");
+	exec({ $prog[0] } @prog) or syserr(_g("exec %s"), "@prog");
     }
     # Close handle that we can't use any more
     close($opts{"from_handle"}) if exists $opts{"from_handle"};