1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

expand-includes: Add simple protection against infinite recursion.

This commit is contained in:
Jelmer Vernooij 2009-01-21 17:32:08 +01:00
parent 2c1d70ab79
commit 076bb89028

View File

@ -3,9 +3,13 @@
# Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPLv3 or later
my $depth = 0;
sub process($)
{
my ($f) = @_;
$depth++;
die("Recursion in $f?") if ($depth > 100);
open(IN, $f) or die("Unable to open $f: $!");
foreach (<IN>) {
my $l = $_;
@ -15,6 +19,7 @@ sub process($)
print $l;
}
}
$depth--;
}
my $path = shift;