Browse code

protect against deep recursion of directories

Hanno Böck authored on09/06/2020 19:12:59
Showing1 changed files
... ...
@@ -109,7 +109,11 @@ if opts.xml:
109 109
 # start the search
110 110
 
111 111
 for fdir in opts.dirs:
112
-    for root, _, files in os.walk(fdir):
112
+    for root, dirs, files in os.walk(fdir):
113
+        # this protects us against nested directories causing
114
+        # an exception
115
+        if root.count(os.sep) > 500:
116
+            del dirs[:]
113 117
         for filename in scanfiles.intersection(files):
114 118
             for item in jconfig:
115 119
                 if not opts.thirdparty and 'thirdparty' in item: