protect against deep recursion of directories
Hanno Böck

Hanno Böck commited on 2020-06-09 19:12:59
Zeige 1 geänderte Dateien mit 5 Einfügungen und 1 Löschungen.

... ...
@@ -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:
116 120