Skip to content

A live bird collage card for your Home Assistant dashboard.

fix: avoid using escapeshellcmd() by injecting $body via STDIN. not very elegant, but keeps with the spirit of escapeshellcmd()

frederika3a2ea6dc4cf
diff --git a/scripts/config.php b/scripts/config.php
index 68b7c06f..08c3af76 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -310,7 +310,11 @@ if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
$body = str_replace("\$overlap", $overlap, $body);
$body = str_replace("\$flickrimage", $exampleimage, $body);
- echo "<pre class=\"bash\">".shell_exec($home."/BirdNET-Pi/birdnet/bin/apprise -vv --plugin-path ".$home."/.apprise/plugins "." -t '".escapeshellcmd($title)."' -b '".escapeshellcmd($body)."' ".$attach." ".$cf." ")."</pre>";
+ $temp = tmpfile();
+ $tpath = stream_get_meta_data($temp)['uri'];
+ fwrite($temp, $body);
+ echo "<pre class=\"bash\">".shell_exec($home."/BirdNET-Pi/birdnet/bin/apprise -vv --plugin-path ".$home."/.apprise/plugins "." -t '".escapeshellcmd($title)."' ".$attach." ".$cf." <".$tpath)."</pre>";
+ fclose($temp);
die();
}