[ZPT] CVS: Zope/lib/python/ZTUtils - Tree.py:1.9
Martijn Pieters
mj@zope.com
Fri, 4 Oct 2002 10:47:54 -0400
Update of /cvs-repository/Zope/lib/python/ZTUtils
In directory cvs.zope.org:/tmp/cvs-serv5231/lib/python/ZTUtils
Modified Files:
Tree.py
Log Message:
Merge Coll #605 fix from 2.6 branch.
=== Zope/lib/python/ZTUtils/Tree.py 1.8 => 1.9 ===
--- Zope/lib/python/ZTUtils/Tree.py:1.8 Thu Oct 3 17:50:17 2002
+++ Zope/lib/python/ZTUtils/Tree.py Fri Oct 4 10:47:54 2002
@@ -200,6 +200,9 @@
If nth is an integer, also return the (map, key) pair for the nth entry.
'''
+ if len(s) > 8192: # Set limit to 8K, to avoid DoS attacks.
+ raise ValueError('Encoded node map too large')
+
map = m = {}
mstack = []
pop = 0
@@ -207,7 +210,7 @@
if nth is not None:
nth_pair = (None, None)
for step in s.split(':'):
- if step == len(step) * '_':
+ if step[0] == '_':
pop = len(step) - 1
continue
if pop < 0: