]> git.proxmox.com Git - pve-common.git/commitdiff
SectionConfig: protect against newline injection
authorDietmar Maurer <dietmar@proxmox.com>
Sun, 20 Sep 2015 08:34:04 +0000 (10:34 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Sun, 20 Sep 2015 08:34:04 +0000 (10:34 +0200)
src/PVE/SectionConfig.pm

index 71d296e6574f7a11d47a67083a45c5188c1b4887..95e166abce88d8101368ee93213b7dda33532525 100644 (file)
@@ -393,6 +393,9 @@ my $format_config_line = sub {
 
     my $ct = $schema->{type};
 
 
     my $ct = $schema->{type};
 
+    die "property '$key' contains a line feed\n"
+       if ($key =~ m/[\n\r]/) || ($value =~ m/[\n\r]/);
+
     if ($ct eq 'boolean') {
        return $value ? "\t$key\n" : '';
     } else {
     if ($ct eq 'boolean') {
        return $value ? "\t$key\n" : '';
     } else {