mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-07-09 11:47:42 +02:00
Fix: Sanitize $peer_conf before output to header
This commit is contained in:
parent
c53c1a27a4
commit
795d55a2cd
@ -13,6 +13,7 @@ if (!isset($_SERVER['HTTP_REFERER'])) {
|
||||
exec("sudo cat " .RASPI_WIREGUARD_PATH.'client.conf', $return);
|
||||
$peer_conf = implode(PHP_EOL,$return);
|
||||
$peer_conf.= PHP_EOL;
|
||||
$peer_conf_sanitized = str_replace(["\r", "\n"], '', $peer_conf);
|
||||
$command = "qrencode -t svg -m 0 -o - " . mb_escapeshellarg($peer_conf);
|
||||
$svg = shell_exec($command);
|
||||
$etag = hash('sha256', $peer_conf);
|
||||
@ -23,6 +24,6 @@ header("Content-Type: image/svg+xml");
|
||||
header("Content-Length: $content_length");
|
||||
header("Last-Modified: $last_modified");
|
||||
header("ETag: \"$etag\"");
|
||||
header("X-QR-Code-Content: $peer_conf");
|
||||
header("X-QR-Code-Content: $peer_conf_sanitized");
|
||||
echo shell_exec($command);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user