public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container 1/2] setup: untaint path to host timezone
@ 2021-10-07 10:48 Fabian Ebner
  2021-10-07 10:48 ` [pve-devel] [PATCH container 2/2] setup: also set contents of /etc/timezone Fabian Ebner
  2021-10-07 12:33 ` [pve-devel] applied: [PATCH container 1/2] setup: untaint path to host timezone Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Fabian Ebner @ 2021-10-07 10:48 UTC (permalink / raw)
  To: pve-devel

To avoid an error with 'pct create ... --timezone host'.

Reported in the community forum:
https://forum.proxmox.com/threads/pct-create-command-with-timezone-host-option-fails-to-create-a-container.97538/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/PVE/LXC/Setup.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index 4e211ef..7c377ab 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -114,7 +114,9 @@ sub new {
 
     # Cache some host files we need access to:
     $plugin->{host_resolv_conf} = PVE::INotify::read_file('resolvconf');
-    $plugin->{host_localtime} = abs_path('/etc/localtime');
+
+    abs_path('/etc/localtime') =~ m|^(/.+)| or die "invalid /etc/localtime\n"; # untaint
+    $plugin->{host_localtime} = $1;
 
     # pass on user namespace information:
     my ($id_map, $rootuid, $rootgid) = PVE::LXC::parse_id_maps($conf);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-07 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 10:48 [pve-devel] [PATCH container 1/2] setup: untaint path to host timezone Fabian Ebner
2021-10-07 10:48 ` [pve-devel] [PATCH container 2/2] setup: also set contents of /etc/timezone Fabian Ebner
2021-10-07 12:34   ` [pve-devel] applied: " Thomas Lamprecht
2021-10-07 12:33 ` [pve-devel] applied: [PATCH container 1/2] setup: untaint path to host timezone Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal