summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-01-21 17:32:08 +0100
committerJelmer Vernooij <jelmer@samba.org>2009-01-21 17:32:08 +0100
commit076bb89028ea4d27a96492b2030d873b0d78ca24 (patch)
tree87de40fb28d17cd6f6f957509316788ace8803f9
parent2c1d70ab79ef3ae9de8074cae7e11cfaa1a84810 (diff)
downloadsamba-076bb89028ea4d27a96492b2030d873b0d78ca24.tar.gz
samba-076bb89028ea4d27a96492b2030d873b0d78ca24.tar.bz2
samba-076bb89028ea4d27a96492b2030d873b0d78ca24.zip
expand-includes: Add simple protection against infinite recursion.
-rwxr-xr-xsource3/script/expand-includes.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/script/expand-includes.pl b/source3/script/expand-includes.pl
index da64363081..33fc44b267 100755
--- a/source3/script/expand-includes.pl
+++ b/source3/script/expand-includes.pl
@@ -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;