chiark / gitweb /
dgit: Reject all git config options containing newlines
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Oct 2018 09:46:41 +0000 (10:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Oct 2018 09:46:41 +0000 (10:46 +0100)
If we find something like this our regexp-based checking approaches
are likely to fail and other strange may will go wrong.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 6dbf166cb72cc7ba698571f1e0c3e799a0c82456..a37e89796fd9c784d9588f1f7e054212eabe70d0 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -790,6 +790,9 @@ sub git_get_config ($) {
        @$l==1 or badcfg
            f_ "multiple values for %s (in %s git config)", $c, $src
            if @$l > 1;
        @$l==1 or badcfg
            f_ "multiple values for %s (in %s git config)", $c, $src
            if @$l > 1;
+       $l->[0] =~ m/\n/ and badcfg f_
+ "value for config option %s (in %s git config) contains newline(s)!",
+            $c, $src;
        return $l->[0];
     }
     return undef;
        return $l->[0];
     }
     return undef;