Skip to content

Commit

Permalink
Added arguments and shell escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
JahleelAbraham committed Mar 21, 2024
1 parent 7551f3d commit 18d2c3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions www/lib/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,12 @@ public function checkConnection() {
ini_set('default_socket_timeout', 1);

$path = "";
$args = "";

switch($this->info['protocol']) {
case 'IP-RTSP':
$path = '-rtsp_transport tcp "rtsp://'.((empty($this->info['rtsp_username'])) ? '' : $this->info['rtsp_username'].':'.$this->info['rtsp_password'].'@').$this->info['ipAddr'].':'.$this->info['port'].$this->info['rtsp'].'"';
$path = 'rtsp://'.((empty($this->info['rtsp_username'])) ? '' : $this->info['rtsp_username'].':'.$this->info['rtsp_password'].'@').$this->info['ipAddr'].':'.$this->info['port'].$this->info['rtsp'];
$args = array("-rtsp_flags +prefer_tcp", "-rtsp_transport tcp", "-rtsp_transport tcp")[$this->info['rtsp_rtp_prefer_tcp']];
break;
case 'IP-MJPEG':
//FIXME: This is the old logic for testing MJPEG. Testing for MJPEG is currently not supported by the bundled ffprobe method used for RTSP
Expand All @@ -789,7 +791,7 @@ public function checkConnection() {

//-> '-stimeout' is measured in microseconds
$ffprobe_output = shell_exec(
"/usr/lib/bluecherry/ffprobe -stimeout 5000000 -hide_banner -show_format -show_streams -print_format json ".$path);
"/usr/lib/bluecherry/ffprobe -stimeout 5000000 -hide_banner -show_format -show_streams -print_format json ".$args. " " . escapeshellarg($path));

$rtsp_data = json_decode($ffprobe_output, true);

Expand Down

0 comments on commit 18d2c3b

Please sign in to comment.