diff options
Diffstat (limited to 'Lib/urllib/parse.py')
-rw-r--r-- | Lib/urllib/parse.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index bf16d0f..67ba308 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -740,12 +740,13 @@ def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, # is less than max_num_fields. This prevents a memory exhaustion DOS # attack via post bodies with many fields. if max_num_fields is not None: - num_fields = 1 + qs.count(separator) + num_fields = 1 + qs.count(separator) if qs else 0 if max_num_fields < num_fields: raise ValueError('Max number of fields exceeded') r = [] - for name_value in qs.split(separator): + query_args = qs.split(separator) if qs else [] + for name_value in query_args: if not name_value and not strict_parsing: continue nv = name_value.split('=', 1) |