]> granicus.if.org Git - php/commitdiff
Escape value passed to exec()
authorSara Golemon <pollita@php.net>
Thu, 1 Jun 2017 22:42:17 +0000 (15:42 -0700)
committerSara Golemon <pollita@php.net>
Thu, 1 Jun 2017 22:43:25 +0000 (15:43 -0700)
getmypid() is safe, but no harm being EXTRA safe.

ext/phar/tests/tar/bug70417.phpt

index 9d30aae7a973213069b4dfeb10b1c7afe855903f..0202ca9472afebd3f0574729add7cadbdcfe2f35 100644 (file)
@@ -13,7 +13,7 @@ if ($status !== 0) {
 --FILE--
 <?php
 function countOpenFiles() {
-    exec('lsof -p ' . getmypid() . ' 2> /dev/null', $out);
+    exec('lsof -p ' . escapeshellarg(getmypid()) . ' 2> /dev/null', $out);
     return count($out);
 }
 $filename = __DIR__ . '/bug70417.tar';