Skip to content

Commit f987afa

Browse files
flichtenheldJunio C Hamano
authored andcommitted
cvsserver: Limit config parser to needed options
Change the configuration parser so that it ignores everything except for ^gitcvs.((ext|pserver).)? This greatly reduces the risk of failing while parsing some unknown and irrelevant config option. The bug that triggered this change was that the parsing doesn't handle sections that have a subsection and a variable with the same name. While this bug still remains, all remaining causes can be attributed to user error, since there are no defined variables gitcvs.ext and gitcvs.pserver. Signed-off-by: Frank Lichtenheld <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 198a2a8 commit f987afa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git-cvsserver.perl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ sub req_Root
183183
}
184184
foreach my $line ( @gitvars )
185185
{
186-
next unless ( $line =~ /^(.*?)\.(.*?)(?:\.(.*?))?=(.*)$/ );
187-
unless ($3) {
188-
$cfg->{$1}{$2} = $4;
186+
next unless ( $line =~ /^(gitcvs)\.(?:(ext|pserver)\.)?([\w-]+)=(.*)$/ );
187+
unless ($2) {
188+
$cfg->{$1}{$3} = $4;
189189
} else {
190190
$cfg->{$1}{$2}{$3} = $4;
191191
}

0 commit comments

Comments
 (0)